diff --git a/cmd/auth_client.go b/cmd/auth_client.go index ed06728e..a67e7f51 100644 --- a/cmd/auth_client.go +++ b/cmd/auth_client.go @@ -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" ) @@ -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) } @@ -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) } @@ -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) } @@ -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) } @@ -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) } diff --git a/cmd/changefromtfplan.go b/cmd/changefromtfplan.go index 23f3e6b6..e6d0e0fa 100644 --- a/cmd/changefromtfplan.go +++ b/cmd/changefromtfplan.go @@ -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") diff --git a/cmd/request.go b/cmd/request.go index 3456e881..0a8f2009 100644 --- a/cmd/request.go +++ b/cmd/request.go @@ -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")