Skip to content

Commit

Permalink
Update utils
Browse files Browse the repository at this point in the history
  • Loading branch information
antoniomika committed Nov 16, 2024
1 parent adf572f commit 8e0e7f4
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions auth/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ func keyHandler(w http.ResponseWriter, r *http.Request) {

space := r.URL.Query().Get("space")
if space == "" {
spaceErr := fmt.Errorf("Must provide `space` query parameter")
spaceErr := fmt.Errorf("must provide `space` query parameter")
client.Logger.Error(spaceErr.Error())
http.Error(w, spaceErr.Error(), http.StatusUnprocessableEntity)
}
Expand Down Expand Up @@ -644,7 +644,7 @@ func handler(routes []shared.Route, client *Client) http.HandlerFunc {

func metricDrainSub(ctx context.Context, dbpool db.DB, logger *slog.Logger, secret string) {
conn := shared.NewPicoPipeClient()
stdoutPipe, err := pipe.Sub("sub metric-drain -k", ctx, conn)
stdoutPipe, err := pipe.Sub(ctx, logger, conn, "sub metric-drain -k")

if err != nil {
logger.Error("could not sub to metric-drain", "err", err)
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ require (
github.com/picosh/pubsub v0.0.0-20241114191831-ec8f16c0eb88
github.com/picosh/send v0.0.0-20241107150437-0febb0049b4f
github.com/picosh/tunkit v0.0.0-20240905223921-532404cef9d9
github.com/picosh/utils v0.0.0-20241116165501-b922efcc56f4
github.com/picosh/utils v0.0.0-20241116191332-39c204dc4605
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06
github.com/sendgrid/sendgrid-go v3.16.0+incompatible
github.com/simplesurance/go-ip-anonymizer v0.0.0-20200429124537-35a880f8e87d
Expand Down
5 changes: 2 additions & 3 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -277,9 +277,8 @@ github.com/picosh/senpai v0.0.0-20240503200611-af89e73973b0 h1:pBRIbiCj7K6rGELij
github.com/picosh/senpai v0.0.0-20240503200611-af89e73973b0/go.mod h1:QaBDtybFC5gz7EG/9c3bgzuyW7W5W2rYLFZxWNuWk3Q=
github.com/picosh/tunkit v0.0.0-20240905223921-532404cef9d9 h1:g5oZmnDFr11HarA8IAXcc4o9PBlolSM59QIATCSoato=
github.com/picosh/tunkit v0.0.0-20240905223921-532404cef9d9/go.mod h1:UrDH/VCIc1wg/L6iY2zSYt4TiGw+25GsKSnkVkU40Dw=
github.com/picosh/utils v0.0.0-20241018143404-b351d5d765f3/go.mod h1:ftrp1FjbKK/mFnBAYGymA1QEtPlkA0+lWkPI5h0HKt4=
github.com/picosh/utils v0.0.0-20241116165501-b922efcc56f4 h1:F5HYOJKgAVjZHjqrZPwPHbJwiH2VMK5cgfruc/c7GU8=
github.com/picosh/utils v0.0.0-20241116165501-b922efcc56f4/go.mod h1:HogYEyJ43IGXrOa3D/kjM1pkzNAyh+pejRyv8Eo//pk=
github.com/picosh/utils v0.0.0-20241116191332-39c204dc4605 h1:A9yRvOupUH9gxGJ/r+4x2RL2uZVEf2Am2AfiLrAfaTg=
github.com/picosh/utils v0.0.0-20241116191332-39c204dc4605/go.mod h1:HogYEyJ43IGXrOa3D/kjM1pkzNAyh+pejRyv8Eo//pk=
github.com/pkg/sftp v1.13.7 h1:uv+I3nNJvlKZIQGSr8JVQLNHFU9YhhNpvC14Y6KgmSM=
github.com/pkg/sftp v1.13.7/go.mod h1:KMKI0t3T6hfA+lTR/ssZdunHo+uwq7ghoN09/FSu3DY=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
Expand Down
2 changes: 1 addition & 1 deletion pico/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func (c *Cmd) notifications() error {

func (c *Cmd) logs(ctx context.Context) error {
conn := shared.NewPicoPipeClient()
stdoutPipe, err := pipeLogger.ReadLogs(ctx, conn)
stdoutPipe, err := pipeLogger.ReadLogs(ctx, c.Log, conn)

if err != nil {
return err
Expand Down
3 changes: 2 additions & 1 deletion shared/analytics.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package shared

import (
"context"
"crypto/hmac"
"crypto/sha256"
"encoding/hex"
Expand Down Expand Up @@ -167,7 +168,7 @@ func AnalyticsVisitFromRequest(r *http.Request, dbpool db.DB, userID string) (*d

func AnalyticsCollect(ch chan *db.AnalyticsVisits, dbpool db.DB, logger *slog.Logger) {
info := NewPicoPipeClient()
metricDrain, err := pipe.NewClient(logger, info)
metricDrain, err := pipe.NewClient(context.Background(), logger, info)
if err != nil {
logger.Error("could not create metric-drain client", "err", err)
return
Expand Down
2 changes: 1 addition & 1 deletion tui/logs/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ func (m Model) waitForActivity(sub chan map[string]any) tea.Cmd {
func (m Model) connectLogs(sub chan map[string]any) tea.Cmd {
return func() tea.Msg {
conn := shared.NewPicoPipeClient()
stdoutPipe, err := pipeLogger.ReadLogs(m.ctx, conn)
stdoutPipe, err := pipeLogger.ReadLogs(m.ctx, m.shared.Logger, conn)
if err != nil {
return errMsg(err)
}
Expand Down

0 comments on commit 8e0e7f4

Please sign in to comment.