-
Notifications
You must be signed in to change notification settings - Fork 290
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow env variables to reference previously defined env vars in same configuration file #1262
Comments
Bonus points to allow referencing such variables in |
I think this could be done. We read each env var one at a time so we could modify the tera context while we read in the file. Here is where we parse the env vars in the toml parser: What it does is call Then it looks like it becomes immutable and never changes. I think what we would want to do is probably wrap it in a Mutex so we can modify it and each time we read an env var we will write to the context and update values. However this is only within a single file. If you wanted to have ~/src/myproj/.rtx.toml read env vars that ~/.config/rtx/config.toml created that would be far, far more difficult because config parsing happens in parallel. I think what we would need to do is make just the env var populating happen in series but the rest of the parsing still happen in parallel. |
This lazy-loads the env vars from config files. This is a prereq for #1262 and other env var changes. It will make it easier to perform the template logic in order across the env vars rather than when the file is parsed
This lazy-loads the env vars from config files. This is a prereq for #1262 and other env var changes. It will make it easier to perform the template logic in order across the env vars rather than when the file is parsed
you have no idea how much work this was, but it's out now. I had to completely rewrite basically everything involving env vars in the project. I felt this was an essential feature though. |
Awesome, thanks @jdx! |
I often find myself having to reference environment variables from others, e.g.:
Would it possible to add support for this?
The text was updated successfully, but these errors were encountered: