def test_access_token_config(self): config_dict = { POLYAXON_KEYS_AUTH_USERNAME: "******", POLYAXON_KEYS_AUTH_TOKEN: "sdfsdf098sdf80s9dSDF800", } config = AccessTokenConfig.from_dict(config_dict) assert config.to_dict() == config_dict
def get_config_from_env(cls) -> AccessTokenConfig: tmp_path = os.path.join(CONTEXT_TMP_POLYAXON_PATH, cls.CONFIG_FILE_NAME) user_path = os.path.join(CONTEXT_USER_POLYAXON_PATH, cls.CONFIG_FILE_NAME) auth_config = ConfigManager.read_configs([ os.environ, ConfigSpec(tmp_path, config_type=".json", check_if_exists=False), ConfigSpec(user_path, config_type=".json", check_if_exists=False), ConfigSpec(CONTEXT_MOUNT_AUTH, config_type=".json", check_if_exists=False), { "dummy": "dummy" }, ]) return AccessTokenConfig.from_dict(auth_config.data)
{"dummy": "dummy"}, ] ) config = rhea.Rhea.read_configs( [ os.environ, rhea.ConfigSpec( TMP_CLIENT_CONFIG_PATH, config_type=".json", check_if_exists=False ), rhea.ConfigSpec( USER_CLIENT_CONFIG_PATH, config_type=".json", check_if_exists=False ), ] ) AUTH_CONFIG = AccessTokenConfig.from_dict(auth_config.data) CLIENT_CONFIG = ClientConfig.from_dict(config.data) HASH_LENGTH = config.get_int(POLYAXON_KEYS_HASH_LENGTH, is_optional=True, default=12) HEALTH_CHECK_URL = config.get_string(POLYAXON_KEYS_HEALTH_CHECK_URL, is_optional=True) RECONCILE_URL = config.get_string(POLYAXON_KEYS_RECONCILE_URL, is_optional=True) MIN_TIMEOUT = config.get_int("POLYAXON_MIN_TIMEOUT", is_optional=True, default=1) REQUEST_TIMEOUT = config.get_int( "POLYAXON_REQUEST_TIMEOUT", is_optional=True, default=25 ) LONG_REQUEST_TIMEOUT = config.get_int( "POLYAXON_LONG_REQUEST_TIMEOUT", is_optional=True, default=3600 ) HEALTH_CHECK_INTERVAL = config.get_int( "HEALTH_CHECK_INTERVAL", is_optional=True, default=60