feat: brownie config supports env vars#1012
feat: brownie config supports env vars#1012iamdefinitelyahuman merged 4 commits intoeth-brownie:masterfrom
Conversation
|
Would love to see an example in the docs using a non-infura RPC_URL for the host too <3 Just a humble request, great work so far on this! |
|
Thanks! Will try my best to get this done as soon as I can. |
d7fa43b to
c51dc7b
Compare
fee10bc to
305da12
Compare
7ddf206 to
5790af1
Compare
|
Ok, I think this is coming together now and nearing completion. I'm still seeing a lot of test failures but I have a feeling they're all from the same root cause. |
|
Ok, going to dive into this now. Will tidy up and minimize the diff. |
f31081c to
66643db
Compare
66643db to
f05ad0d
Compare
|
Ok, I figured out what I was doing wrong:
Some takeaways:
As for the most recent failures, I believe I'm just getting rate-limited (sorry about that). Either way, my optimistic engineering self thinks that this should work when I try it again a little bit later on. Going to mark it ready for review to start getting feedback; @iamdefinitelyahuman and maintainers: feel free to re-run tests when you take a look at this PR and I think everything will be passing. I'll also check again in a couple of hours. Also, apologies to anyone else who was held up waiting for my 6h builds to finish. |
|
Also @PatrickAlphaC for sure re: example with RPC_URL. Where in the docs do you think it makes the most sense? |
6ae54d6 to
a221f04
Compare
a221f04 to
5d99f4f
Compare
iamdefinitelyahuman
left a comment
There was a problem hiding this comment.
Generally this looks really good! Just a few minor nitpicks / questions.
|
AMAZING |
|
Hey @kkom: good question. It's been a little bit since I did this PR so I don't 100% remember if there was a reason I had pinned it that way. I think this one is @iamdefinitelyahuman's call, but here's what I think:
|
|
Sounds good! Btw, what's your thought on the upper constraint? Technically according to semver anything can happen before you hit |
|
Great question. Yeah there's the essence of semver and there's how it's
actually done. I'd be comfortable with `<0.21.0` if it was only my say, but
I'm going to yield to @iamdefinitelyahuman on what we actually end up doing.
|
|
Sure thing! My 2 cents are the following – before finalizing the PR I'd take a look at the usages of the library, if they look very basic and unlikely to change – I'd recommend to do |
This feature adds POSIX-style environment variable expansion to Brownie's config. You can now access environment variables, like you would
os.environ, or, define them using the new top-leveldotenvflag brownie's configuration.What I did
dotenv:key tobrownie-config.ymlos.environas well as a.envfile (when specified)${THE_REAL_DEAL:-dentacoin}, or${NEEDS_MORE_COWBELL:-true}intandbool.Related issue: #1000
Demos:
System env vars:
export SHOW_COLORS=truebrownie-config.ymlUsing a
.envfile.env:BUILD_DIR=/dev/teapotbrownie-config.ymlHow I did it
How to verify it
See the tests.
Checklist