【发布时间】:2020-08-26 08:07:53
【问题描述】:
根据PrefectConfiguration guide,我已经通过export PREFECT__USER_CONFIG_PATH="./config.toml" 设置了一个本地配置文件(即在我当前的工作目录中),但是,这需要在每个shell 会话中设置环境变量。
我尝试使用 prefect.config.user_config_path = "./config.toml" 在 Python 脚本中设置配置,但这似乎与 export 加载配置文件的方式不同,因为:
(来自 docs)“配置文件在 Prefect 首次导入时进行解析,并在 prefect.config 中作为活动对象提供。”
对于我的假人config.toml 数据:
[api]
host = "localhost"
port = "5432"
url = "https://${api.host}:${api.port}"
prefect.config 通过环境变量:
...'task_runner': {'default_class': 'prefect.engine.task_runner.TaskRunner'}}, 'api': {'host': 'localhost', 'port': 5432, 'url': 'https://localhost:5432'}, 'user_config_path': './config.toml'}>
prefect.config 通过脚本:
...'task_runner': {'default_class': 'prefect.engine.task_runner.TaskRunner'}}, 'user_config_path': './config.toml'}>
所以config.toml 变量不会在第二种情况下加载
有什么想法吗?
(应用程序:我想在我的本地 config.toml 文件中设置一个“完美”秘密,隐藏在源代码管理中)
【问题讨论】:
标签: prefect