Closed CiderHider closed 1 month ago
Thanks for your feature request!
I think this would be quite doable to implement. In settings a field to configure a path to the .env file and then before it starts any dbt process it will source that file. Only question then is which overrides which in case you have an env file as well as normal env vars via the settings configured.
Thanks for the quick response. I would say specifically set Env vars override .env vars in the file. That way you still retain control over the tool in the settings, in case some variable settings dont line up.
Thanks for the quick response. I would say specifically set Env vars override .env vars in the file. That way you still retain control over the tool in the settings, in case some variable settings dont line up.
Makes sense, maybe I can also make a mechanism to check for a project if there is a .env
file in the root of the repository, and if it can find that file it will use it. However I assume a lot of projects might have it in a subdir, and even have different .env files (e.g. dev.env
, test.env
, prod.env
, etc.)
So I still need to do some more thinking/designing to come up with a neat solution for that. I will try to do this in the next release, however I can't promise any timelines haha. Currently quite busy at the job, and this really is a side-project for me, but I'll do my best!
@CiderHider FYI opened a draft PR which is still WIP to support dotenv files: https://github.com/ramonvermeulen/dbt-toolkit/pull/136
Aiming to put this in the release of the 27th of September.
Amazing, thank you Ramon.
Description
Currently environment variables are defined separately in the settings. Project environment variables are often defined in a central .env file. I would request .env file support for this tool. This would enable access to centrally managed project environment variables.
Current Behavior
Environment variables for DBT are defined in the dbt-toolkit settings.
Proposed Behavior
Environment variables can additionally be defined in an .env file. The file is targeted via a path in the dbt-toolkit settings.
Motivation
All needed environment variables can be defined and managed in a centralized file for the whole project.