def get_kv_settings(config_file): test_config = Path(_TEST_DATA).joinpath(config_file) os.environ[pkg_config._CONFIG_ENV_VAR] = str(test_config) with warnings.catch_warnings(): # We want to ignore warnings from missing config warnings.simplefilter("ignore", category=UserWarning) with custom_mp_config(test_config): return KeyVaultSettings()
def _read_config_settings(conf_file): sys_config = conf_file = os.environ["MSTICPYCONFIG"] if not conf_file: conf_file = sys_config if not conf_file: raise ValueError("Configuration file not found.") with open(conf_file, "r") as conf_hdl: cur_settings = yaml.safe_load(conf_hdl) # temporarily set env var to point to conf_file os.environ["MSTICPYCONFIG"] = conf_file config.refresh_config() kvlt_settings = KeyVaultSettings() os.environ["MSTICPYCONFIG"] = sys_config return cur_settings, kvlt_settings