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 crate specific .env files #270

Merged

Conversation

xyzd0
Copy link
Contributor

@xyzd0 xyzd0 commented Apr 19, 2020

This change will attempt to load an .env file from CARGO_MANIFEST_DIR, if it exists.

For backwards compatibility, if the .env file does not exist, we will fall back to default dotenv behaviour.

Resolves #267

@mehcode mehcode requested a review from abonander April 19, 2020 23:12
sqlx-macros/src/lib.rs Outdated Show resolved Hide resolved
Copy link
Collaborator

@abonander abonander left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me minus a couple nits.

sqlx-macros/src/lib.rs Outdated Show resolved Hide resolved
sqlx-macros/src/lib.rs Outdated Show resolved Hide resolved
@xyzd0 xyzd0 force-pushed the use-cargo-manifest-dir-to-load-env-variables branch from 8dfd088 to d52576c Compare April 21, 2020 20:05
@xyzd0 xyzd0 requested a review from abonander April 21, 2020 20:06
@xyzd0 xyzd0 force-pushed the use-cargo-manifest-dir-to-load-env-variables branch from d52576c to f3265c6 Compare April 21, 2020 20:11
@xyzd0
Copy link
Contributor Author

xyzd0 commented Apr 21, 2020

Changes made, rebased + pushed 😃

Copy link
Collaborator

@abonander abonander left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, one last nit and then it's good to go. It's not super important, just sort of a "best practices" thing.

sqlx-macros/src/lib.rs Outdated Show resolved Hide resolved
This change will attempt to load an .env file from CARGO_MANIFEST_DIR, if it exists.

For backwards compatibility, if the .env file does not exist, we will fall back to default dotenv behaviour.

Resolves launchbadge#267
@xyzd0 xyzd0 force-pushed the use-cargo-manifest-dir-to-load-env-variables branch from f3265c6 to f9a7b66 Compare April 22, 2020 10:02
@xyzd0 xyzd0 requested a review from abonander April 22, 2020 10:03
@mehcode mehcode merged commit e7c1486 into launchbadge:master Apr 24, 2020
@mehcode
Copy link
Member

mehcode commented Apr 24, 2020

Thanks for the contribution here 👍

@xyzd0 xyzd0 deleted the use-cargo-manifest-dir-to-load-env-variables branch April 24, 2020 22:42
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.

.env Support for Repositories with Multiple Crates
4 participants