https://prefect.io logo
Title
j

Jovan Sakovic

04/16/2022, 5:20 PM
Hi Prefectionists 😛refect-duck: Is it possible to reference an environment variable in the
config.toml
? Specific example, using an external Postgres db, and adding its connection URL in the
config.toml
under
[server.database]
. It’d be good to keep the URL a secret, but still version control the file. Or perhaps there’s a different way of configuring this, instead of adding it in the
.toml
file? Thanks in advance 🙌
k

Kevin Kho

04/16/2022, 5:45 PM
You can configure the env var directly to override the toml. Like
export PREFECT__SERVER__DATABASE=...
but I don’t think the toml file format can read an env var.
All of the toml configurations can be configured by env variables
j

Jeremiah

04/16/2022, 9:15 PM
In Prefect 1.0 we actually added custom interpolation to the toml file so you can both reference env variables and other config settings. See: https://docs.prefect.io/core/concepts/configuration.html#extensions
:upvote: 1
k

Kevin Kho

04/16/2022, 10:19 PM
Wow that’s news to me. Ignore what I said.
😂 2
j

Jovan Sakovic

04/18/2022, 11:57 AM
Thank you both!! 🙌 This is a pretty nice feature in 1.0 🚀