question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add support for python-dotenv at the config level

See original GitHub issue

Overview

I’d love to see brownie support a .env file for environment variables. For new engineers, or a project that doesn’t want to keep a ton of environment variables running, a .env file is a warm welcome. Truffle and Hardhat (the javascript smart contract frameworks) have really nice config files that allow them to work with .env files. A bit of a quality of life improvement.

Otherwise, we have to call in the .env file in all our script manually, seems pretty redundant to do so.

Specification

Not sure how this is normal done in yaml, but would like to see something like: dotenv: true

And then they can load via a .env file. We could just use https://pypi.org/project/python-dotenv/ to load at the start of all the scripts.

Dependencies

https://pypi.org/project/python-dotenv/

What do we think?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:14 (13 by maintainers)

github_iconTop GitHub Comments

3reactions
omarishcommented, Mar 22, 2021

I agree. I’d just like to get buy-in from @iamdefinitelyahuman before building something out.

When it comes to crypto projects, I’m an advocate for configuration over convention. Writing an extra line in a config file is a great price to pay, especially if it means avoiding unexpected configuration behavior.

2reactions
omarishcommented, Apr 15, 2021

Makes sense. I can add this in; should be pretty straightforward. Sorry for the delay, recently made the 2to3 family migration and just getting back into my routine now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

environment variables - What is the use of python-dotenv?
env and adds them to environment variable. It is great of managing app settings during development and in production using 12-factor principles.
Read more >
Using .env Files for Environment Variables in Python ...
I am a noob, trying to learn python along with good practices. Now the queries: The official python-dotenv documentation talks about using the ......
Read more >
python-dotenv - Python Package Health Analysis - Snyk
To help you with that, you can add Python-dotenv to your application to make it load the configuration from a .env file when...
Read more >
python-dotenv - GitHub
Reads key-value pairs from a .env file and can set them as environment variables. It helps in developing applications following the 12-factor principles....
Read more >
Using Environment Variables in Python for App Configuration ...
Here are some examples of using environment variables to configure a Python script or application: Set FLASK_ENV environment variable to ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found