Skip to content
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

Add support for dotenv files #104

Merged
merged 1 commit into from
Aug 4, 2024
Merged

Add support for dotenv files #104

merged 1 commit into from
Aug 4, 2024

Conversation

rliebz
Copy link
Owner

@rliebz rliebz commented Apr 9, 2024

While I'm not sure there is a formal dotenv specification, I've used a library that's meant to be compatible with other language libraries, which should make things pretty familiar and compatible.

I've also attempted to model the semantics used by Docker Compose for file configuration, although 100% compatibility is probably not a guarantee this project will ever make.

Closes #98
Supercedes #99

@rliebz rliebz force-pushed the env-file branch 2 times, most recently from 9b05870 to 6224278 Compare April 9, 2024 04:04
@rliebz
Copy link
Owner Author

rliebz commented Apr 9, 2024

@elyoni @smyrman—Here's my first pass at environment file support. Let me know if you have any thoughts here, or if there's anything this doesn't solve for that you think belongs in the first iteration.

One feature that was mentioned that I would probably punt on for now is specifying environment files anywhere other than the root of the configuration file. One of the weird things about sub-tasks and environment variables is that once an env var is set, there aren't super direct/obvious semantics for if that scope ends, or how that would interact with sub-tasks. Which is why run.set-environment very explicitly includes the word "set" and calls out that the change will persist until the program exits. That doesn't mean task-level env files can't ever happen, though, and I don't think this PR does anything that would make it harder down the line if a good design becomes obvious at any point.

While I'm not sure there is a formal dotenv specification, I've used a
library that's meant to be compatible with other language libraries,
which should make things pretty familiar and compatible.

I've also attempted to model the semantics used by Docker Compose for
file configuration, although 100% compatibility is probably not a
guarantee this project will ever make.
@rliebz rliebz merged commit ed0bf60 into main Aug 4, 2024
5 checks passed
@rliebz rliebz deleted the env-file branch August 4, 2024 11:16
@smyrman
Copy link

smyrman commented Aug 4, 2024

Sorry for not responding to your comment on Apr. 9; I might just forgot to answer as we haven't tried this out yet. I'll be sure to give you any feedback when we get to try this out. The feature as you describe it in the new docs sounds reasonable.

I might add that we are very happy with tusk in our organization.

@rliebz
Copy link
Owner Author

rliebz commented Aug 6, 2024

All good! Thanks for taking a look, I'll probably push a release out shortly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Load(source) environment variables from a file as configuration file.
2 participants