@@ -243,6 +243,8 @@ def initialize_auth_client_context(
243
243
# TODO?: initial_token_data: dict = None,
244
244
save_token_file : bool = True ,
245
245
save_profile_config : bool = False ,
246
+ use_env : bool = True ,
247
+ use_configfile : bool = True ,
246
248
# Not supporting custom storage providers at this time.
247
249
# The preferred behavior of Profiles with custom storage providers is TBD.
248
250
# storage_provider: Optional[ObjectStorageProvider] = None,
@@ -312,6 +314,8 @@ def my_cli_main(ctx, auth_profile, auth_client_id, auth_client_secret):
312
314
save_token_file: Whether to save the access token to disk. If `False`, in-memory
313
315
operation will be used, and login sessions will not be persisted locally.
314
316
save_profile_config: Whether to save the profile configuration to disk.
317
+ use_env: Whether to use environment variables to determine configuration values.
318
+ use_configfile: Whether to use configuration files to determine configuration values.
315
319
"""
316
320
#
317
321
# Initialize from explicit user selected options
@@ -346,6 +350,8 @@ def my_cli_main(ctx, auth_profile, auth_client_id, auth_client_secret):
346
350
effective_user_selected_profile = user_config_file .effective_conf_value (
347
351
config_key = EnvironmentVariables .AUTH_PROFILE ,
348
352
override_value = auth_profile_opt ,
353
+ use_env = use_env ,
354
+ use_configfile = use_configfile ,
349
355
)
350
356
if effective_user_selected_profile :
351
357
try :
@@ -365,10 +371,14 @@ def my_cli_main(ctx, auth_profile, auth_client_id, auth_client_secret):
365
371
effective_user_selected_client_id = user_config_file .effective_conf_value (
366
372
config_key = EnvironmentVariables .AUTH_CLIENT_ID ,
367
373
override_value = auth_client_id_opt ,
374
+ use_env = use_env ,
375
+ use_configfile = use_configfile ,
368
376
)
369
377
effective_user_selected_client_secret = user_config_file .effective_conf_value (
370
378
config_key = EnvironmentVariables .AUTH_CLIENT_SECRET ,
371
379
override_value = auth_client_secret_opt ,
380
+ use_env = use_env ,
381
+ use_configfile = use_configfile ,
372
382
)
373
383
if effective_user_selected_client_id and effective_user_selected_client_secret :
374
384
return PlanetAuthFactory ._init_context_from_oauth_svc_account (
@@ -383,16 +393,19 @@ def my_cli_main(ctx, auth_profile, auth_client_id, auth_client_secret):
383
393
effective_user_selected_api_key = user_config_file .effective_conf_value (
384
394
config_key = EnvironmentVariables .AUTH_API_KEY ,
385
395
override_value = auth_api_key_opt ,
396
+ use_env = use_env ,
397
+ use_configfile = use_configfile ,
386
398
)
387
399
if effective_user_selected_api_key :
388
400
return PlanetAuthFactory ._init_context_from_api_key (
389
401
api_key = effective_user_selected_api_key ,
390
402
)
391
403
392
404
effective_user_selected_api_key = user_config_file .effective_conf_value (
393
- config_key = "key" , # For backwards compatibility
405
+ config_key = "key" , # For backwards compatibility, we know the old SDK used this in json files.
394
406
override_value = auth_api_key_opt ,
395
407
use_env = False ,
408
+ use_configfile = use_configfile ,
396
409
)
397
410
if effective_user_selected_api_key :
398
411
return PlanetAuthFactory ._init_context_from_api_key (
0 commit comments