-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
feat: dotenv support #2587
feat: dotenv support #2587
Conversation
/// We could use `tracing::warn!` here, but that would imply that the dotenv file can't configure | ||
/// the logging behavior of Foundry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... because we would need to register the subscriber before loading .env
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will now auto load regardless which is a big change.
I think we should consider making this opt-in via Config?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure... if config is loaded, then dotenv won't take effect on config values? also, not sure why you would have a .env in your project w/o it being related. Not sure
Maybe it's possible to write a Figment provider? Although that would mean things outside the scope of config won't be interpreted (NO_COLOR
etc)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also rewrites the Solc reporter using yansi so the indicator respects NO_COLOR. Unfortunately it does not seem like yansi has the "clear line" etc. escape sequences
can split this to another PR?
/// We could use `tracing::warn!` here, but that would imply that the dotenv file can't configure | ||
/// the logging behavior of Foundry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will now auto load regardless which is a big change.
I think we should consider making this opt-in via Config?
yep |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be always on? i'd make it opt-in via foundry toml maybe? dotenv = "<path>"
?
@gakonst I don't see why you would have a Edit: Alternatively, if Clap allows, we could have a |
ok let's just ship it as-is and see what the feedback is :p |
Motivation
People want
.env
supportSolution
Loads
.env
before anything else so anything is configurable (NO_COLOR
etc). Uses thedotenv
crate which hasn't had an update in a while, but is widely used. Not sure if there are good alternatives.Closes #840