@@ -243,6 +243,8 @@ def initialize_auth_client_context(
243243 # TODO?: initial_token_data: dict = None,
244244 save_token_file : bool = True ,
245245 save_profile_config : bool = False ,
246+ use_env : bool = True ,
247+ use_configfile : bool = True ,
246248 # Not supporting custom storage providers at this time.
247249 # The preferred behavior of Profiles with custom storage providers is TBD.
248250 # storage_provider: Optional[ObjectStorageProvider] = None,
@@ -312,6 +314,8 @@ def my_cli_main(ctx, auth_profile, auth_client_id, auth_client_secret):
312314 save_token_file: Whether to save the access token to disk. If `False`, in-memory
313315 operation will be used, and login sessions will not be persisted locally.
314316 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.
315319 """
316320 #
317321 # Initialize from explicit user selected options
@@ -346,6 +350,8 @@ def my_cli_main(ctx, auth_profile, auth_client_id, auth_client_secret):
346350 effective_user_selected_profile = user_config_file .effective_conf_value (
347351 config_key = EnvironmentVariables .AUTH_PROFILE ,
348352 override_value = auth_profile_opt ,
353+ use_env = use_env ,
354+ use_configfile = use_configfile ,
349355 )
350356 if effective_user_selected_profile :
351357 try :
@@ -365,10 +371,14 @@ def my_cli_main(ctx, auth_profile, auth_client_id, auth_client_secret):
365371 effective_user_selected_client_id = user_config_file .effective_conf_value (
366372 config_key = EnvironmentVariables .AUTH_CLIENT_ID ,
367373 override_value = auth_client_id_opt ,
374+ use_env = use_env ,
375+ use_configfile = use_configfile ,
368376 )
369377 effective_user_selected_client_secret = user_config_file .effective_conf_value (
370378 config_key = EnvironmentVariables .AUTH_CLIENT_SECRET ,
371379 override_value = auth_client_secret_opt ,
380+ use_env = use_env ,
381+ use_configfile = use_configfile ,
372382 )
373383 if effective_user_selected_client_id and effective_user_selected_client_secret :
374384 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):
383393 effective_user_selected_api_key = user_config_file .effective_conf_value (
384394 config_key = EnvironmentVariables .AUTH_API_KEY ,
385395 override_value = auth_api_key_opt ,
396+ use_env = use_env ,
397+ use_configfile = use_configfile ,
386398 )
387399 if effective_user_selected_api_key :
388400 return PlanetAuthFactory ._init_context_from_api_key (
389401 api_key = effective_user_selected_api_key ,
390402 )
391403
392404 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.
394406 override_value = auth_api_key_opt ,
395407 use_env = False ,
408+ use_configfile = use_configfile ,
396409 )
397410 if effective_user_selected_api_key :
398411 return PlanetAuthFactory ._init_context_from_api_key (
0 commit comments