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 #14

Merged
merged 1 commit into from Jan 8, 2017

Conversation

Projects
None yet
2 participants
@lholden
Copy link
Contributor

commented Jan 4, 2017

Added dotenv so that the environment variables may be pulled from a .env file.

Lori Holden
@Keats

This comment has been minimized.

Copy link
Owner

commented Jan 6, 2017

I've never used dotenv, what's its use if it doesn't automatically load variables like direnv?

@lholden

This comment has been minimized.

Copy link
Contributor Author

commented Jan 6, 2017

It works a bit like direnv but without needing an external tool. If you have the following .env file:

DBMIGRATE_URL=postgres://postgres@localhost/mydb
DBMIGRATE_PATH=./migrations/

And then have in your code:

dotenv::dotenv().ok();

It will automatically populate your environment with those variables when running your program from that directory. For example, this is what diesel's command line tool uses.

It can also be run as a separate tool.

@Keats Keats merged commit 738a567 into Keats:master Jan 8, 2017

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@Keats

This comment has been minimized.

Copy link
Owner

commented Jan 8, 2017

Thanks! I'm currently travelling but I'll try to release it soon-ish

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.