2019-01-11 19:39:17 +03:00
|
|
|
# -----------------------------------------------------------------------------
|
2018-11-21 02:46:13 +03:00
|
|
|
# Copyright (c) Microsoft Corporation. All rights reserved.
|
2019-01-11 19:39:17 +03:00
|
|
|
# Licensed under the MIT License. See License.txt in the project root for
|
|
|
|
# license information.
|
|
|
|
# -----------------------------------------------------------------------------
|
2018-11-21 02:46:13 +03:00
|
|
|
|
|
|
|
import os
|
|
|
|
|
|
|
|
from knack.config import CLIConfig
|
2018-12-06 00:14:46 +03:00
|
|
|
|
2018-11-21 02:46:13 +03:00
|
|
|
|
|
|
|
def get_azdev_config():
|
|
|
|
return CLIConfig(config_dir=get_azdev_config_dir(), config_env_var_prefix='AZDEV')
|
|
|
|
|
|
|
|
|
|
|
|
def get_azure_config():
|
|
|
|
return CLIConfig(config_dir=get_azure_config_dir(), config_env_var_prefix='AZURE')
|
|
|
|
|
|
|
|
|
|
|
|
def get_azdev_config_dir():
|
|
|
|
""" Returns the user's .azdev directory. """
|
2019-04-02 20:54:36 +03:00
|
|
|
from azdev.utilities import get_env_path
|
|
|
|
env_name = None
|
|
|
|
_, env_name = os.path.splitdrive(get_env_path())
|
|
|
|
azdev_dir = os.getenv('AZDEV_CONFIG_DIR', None) or os.path.expanduser(os.path.join('~', '.azdev'))
|
|
|
|
if not env_name:
|
|
|
|
return azdev_dir
|
|
|
|
return os.path.join(azdev_dir, 'env_config') + env_name
|
2018-11-21 02:46:13 +03:00
|
|
|
|
|
|
|
|
|
|
|
def get_azure_config_dir():
|
|
|
|
""" Returns the user's Azure directory. """
|
|
|
|
return os.getenv('AZURE_CONFIG_DIR', None) or os.path.expanduser(os.path.join('~', '.azure'))
|