Hello Kedro community, I have a question regardin...
# questions
m
Hello Kedro community, I have a question regarding the management of environment variables. Is there a way to use environment variables (ex: MYSQLUSER, MYSQLDB....) in kedro config files (credentials.yml, parameters.yml ...). Thank you very much 🙂
m
Hi @Massinissa Saïdi, at the moment you could use the TemplatedConfigLoader with globals (https://kedro.readthedocs.io/en/stable/kedro_project_setup/configuration.html#template-configuration), but this isn’t necessarily advised. In our next release you’ll be able to use the new
OmegaConfLoader
which will allow you to use environment variables for credentials.
👍 1
m
Hello @Merel, thanks for you answer. Yes indeed I already use this method with globals.yml but is it possible to use `.env`file and update the parameters in .yml files ?
d
it will be - today you’ll have to subclass TemplatedConfigLoader to add env vars
👍 1
m
What kind of parameters do you want to store in environment variables? In Kedro we don’t encourage using environment variables unless it’s for credentials.
m
yes its for credentials. Do avoid to have the same values in differents files (docker-compose.yml and credentials.yml for example) I wanted to use .env file
d
this is how you do it
it used to be easier in 0.17.x
m
Hello again, thanks for sharing. What is the equivalent of `_create_config_loader`method in latest kedro version for KedroContext I cannot find it 😕 ?
I find for now a not proper solution with
envsubst