@@ -48,7 +48,7 @@ For GCP, ensure you have appropriate permissions (roles/browser or equivalent) t
4848// any query or request during the runtime of the CLI. for proper cleanup,
4949// execute the returned function. The method returns once the sources are
5050// started. Progress is reported into the provided multi printer.
51- func StartLocalSources (ctx context.Context , oi sdp.OvermindInstance , token * oauth2.Token , tfArgs []string , failOverToAws bool ) (func (), error ) {
51+ func StartLocalSources (ctx context.Context , oi sdp.OvermindInstance , token * oauth2.Token , tfArgs []string , failOverToDefaultLoginCfg bool ) (func (), error ) {
5252 var err error
5353
5454 multi := pterm .DefaultMultiPrinter
@@ -61,8 +61,7 @@ func StartLocalSources(ctx context.Context, oi sdp.OvermindInstance, token *oaut
6161 gcpSpinner , _ := pterm .DefaultSpinner .WithWriter (multi .NewWriter ()).Start ("Starting GCP source engine" )
6262 statusArea := pterm .DefaultParagraph .WithWriter (multi .NewWriter ())
6363
64- natsOptions := natsOptions (ctx , oi , token )
65- heartbeatOptions := heartbeatOptions (oi , token )
64+ natsOpts := natsOptions (ctx , oi , token )
6665
6766 hostname , err := os .Hostname ()
6867 if err != nil {
@@ -79,9 +78,9 @@ func StartLocalSources(ctx context.Context, oi sdp.OvermindInstance, token *oaut
7978 SourceUUID : uuid .New (),
8079 App : oi .ApiUrl .Host ,
8180 ApiKey : token .AccessToken ,
82- NATSOptions : & natsOptions ,
81+ NATSOptions : & natsOpts ,
8382 MaxParallelExecutions : 2_000 ,
84- HeartbeatOptions : heartbeatOptions ,
83+ HeartbeatOptions : heartbeatOptions ( oi , token ) ,
8584 }
8685 stdlibEngine , err := stdlibSource .InitializeEngine (
8786 & ec ,
@@ -131,7 +130,7 @@ func StartLocalSources(ctx context.Context, oi sdp.OvermindInstance, token *oaut
131130 statusArea .Println (fmt .Sprintf ("Using AWS provider in %s with %s." , p .FilePath , credentials .Source ))
132131 configs = append (configs , c )
133132 }
134- if len (configs ) == 0 && failOverToAws {
133+ if len (configs ) == 0 && failOverToDefaultLoginCfg {
135134 userConfig , err := config .LoadDefaultConfig (ctx )
136135 if err != nil {
137136 awsSpinner .Fail ("Failed to load default AWS config" )
@@ -148,8 +147,8 @@ func StartLocalSources(ctx context.Context, oi sdp.OvermindInstance, token *oaut
148147 App : oi .ApiUrl .Host ,
149148 ApiKey : token .AccessToken ,
150149 MaxParallelExecutions : 2_000 ,
151- NATSOptions : & natsOptions ,
152- HeartbeatOptions : heartbeatOptions ,
150+ NATSOptions : & natsOpts ,
151+ HeartbeatOptions : heartbeatOptions ( oi , token ) ,
153152 }
154153 awsEngine , err := proc .InitializeAwsSourceEngine (
155154 ctx ,
@@ -220,7 +219,7 @@ func StartLocalSources(ctx context.Context, oi sdp.OvermindInstance, token *oaut
220219 }
221220
222221 // Fallback to default GCP config if no terraform providers found
223- if len (gcpConfigs ) == 0 {
222+ if len (gcpConfigs ) == 0 && failOverToDefaultLoginCfg {
224223 statusArea .Println ("No GCP terraform providers found. Attempting to use default GCP credentials." )
225224 // Try to use Application Default Credentials by passing nil config
226225 gcpConfigs = append (gcpConfigs , nil )
@@ -242,8 +241,8 @@ func StartLocalSources(ctx context.Context, oi sdp.OvermindInstance, token *oaut
242241 App : oi .ApiUrl .Host ,
243242 ApiKey : token .AccessToken ,
244243 MaxParallelExecutions : 2_000 ,
245- NATSOptions : & natsOptions ,
246- HeartbeatOptions : heartbeatOptions ,
244+ NATSOptions : & natsOpts ,
245+ HeartbeatOptions : heartbeatOptions ( oi , token ) ,
247246 }
248247
249248 gcpEngine , err := gcpproc .Initialize (ctx , & ec , gcpConfig )
0 commit comments