Exemplo n.º 1
0
 def test_client_config(self):
     config_dict = {
         POLYAXON_KEYS_DEBUG: True,
         POLYAXON_KEYS_HOST: "http://localhost:8000",
         POLYAXON_KEYS_VERIFY_SSL: True,
     }
     config = ClientConfig.from_dict(config_dict)
     assert config.debug is True
     assert config.host == "http://localhost:8000"
     assert config.base_url == "http://localhost:8000/api/v1"
     assert config.verify_ssl is True
Exemplo n.º 2
0
    def get_config_from_env(cls, **kwargs) -> ClientConfig:
        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)

        config = ConfigManager.read_configs(
            [
                ConfigSpec(tmp_path, config_type=".json", check_if_exists=False),
                ConfigSpec(user_path, config_type=".json", check_if_exists=False),
                os.environ,
            ]
        )
        return ClientConfig.from_dict(config.data)