Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions cmd/auth_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (

"github.com/overmindtech/sdp-go"
"github.com/overmindtech/sdp-go/sdpconnect"
log "github.com/sirupsen/logrus"
"github.com/spf13/viper"
"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp"
)
Expand All @@ -20,6 +21,7 @@ func AuthenticatedApiKeyClient(ctx context.Context) sdpconnect.ApiKeyServiceClie
url = viper.GetString("url")
viper.Set("apikey-url", url)
}
log.WithContext(ctx).WithField("apikey-url", url).Debug("Connecting to overmind apikeys API")
return sdpconnect.NewApiKeyServiceClient(httpClient, url)
}

Expand All @@ -31,6 +33,7 @@ func UnauthenticatedApiKeyClient(ctx context.Context) sdpconnect.ApiKeyServiceCl
url = viper.GetString("url")
viper.Set("apikey-url", url)
}
log.WithContext(ctx).WithField("apikey-url", url).Debug("Connecting to overmind apikeys API (unauthenticated)")
return sdpconnect.NewApiKeyServiceClient(otelhttp.DefaultClient, url)
}

Expand All @@ -43,6 +46,7 @@ func AuthenticatedBookmarkClient(ctx context.Context) sdpconnect.BookmarksServic
url = viper.GetString("url")
viper.Set("bookmark-url", url)
}
log.WithContext(ctx).WithField("bookmark-url", url).Debug("Connecting to overmind bookmark API")
return sdpconnect.NewBookmarksServiceClient(httpClient, url)
}

Expand All @@ -55,6 +59,7 @@ func AuthenticatedChangesClient(ctx context.Context) sdpconnect.ChangesServiceCl
url = viper.GetString("url")
viper.Set("changes-url", url)
}
log.WithContext(ctx).WithField("changes-url", url).Debug("Connecting to overmind changes API")
return sdpconnect.NewChangesServiceClient(httpClient, url)
}

Expand All @@ -67,6 +72,7 @@ func AuthenticatedSnapshotsClient(ctx context.Context) sdpconnect.SnapshotsServi
url = viper.GetString("url")
viper.Set("snapshot-url", url)
}
log.WithContext(ctx).WithField("snapshot-url", url).Debug("Connecting to overmind snapshot API")
return sdpconnect.NewSnapshotsServiceClient(httpClient, url)
}

Expand Down
3 changes: 0 additions & 3 deletions cmd/changefromtfplan.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,6 @@ func ChangeFromTfplan(signals chan os.Signal, ready chan bool) int {
"gateway_url": gatewayUrl,
}

// Connect to the websocket
log.WithContext(ctx).WithFields(lf).Debug("Connecting to overmind API")

ctx, err = ensureToken(ctx, signals)
if err != nil {
log.WithContext(ctx).WithFields(lf).WithField("apikey-url", viper.GetString("apikey-url")).WithError(err).Error("failed to authenticate")
Expand Down
3 changes: 0 additions & 3 deletions cmd/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,6 @@ func Request(signals chan os.Signal, ready chan bool) int {
"url": viper.GetString("url"),
}

// Connect to the websocket
log.WithContext(ctx).WithFields(lf).Debug("Connecting to overmind API")

ctx, err = ensureToken(ctx, signals)
if err != nil {
log.WithContext(ctx).WithFields(lf).WithField("apikey-url", viper.GetString("apikey-url")).WithError(err).Error("failed to authenticate")
Expand Down