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

feat(sqlx-cli): Add flag to disable automatic loading of .env files #3724

Merged
merged 2 commits into from
Feb 4, 2025

Conversation

benwilber
Copy link
Contributor

Does your PR solve an issue?

#3722

Automatic loading of .env files can be dangerous (and destructive). It is possible to run an sqlx database command against a database that you did not expect just by virtue of there being a hidden .env file in the directory from which you ran the command.

This PR adds a top-level switch to the sqlx CLI --no-dotenv which will disable the automatic loading of .env files. This makes it safer to use in scripts and allows developers to make loading .env files explicit if they want.

sqlx-cli/src/opt.rs Outdated Show resolved Hide resolved
Co-authored-by: Austin Bonander <[email protected]>
@benwilber benwilber requested a review from abonander February 4, 2025 01:30
@abonander abonander merged commit 91291be into launchbadge:main Feb 4, 2025
81 checks passed
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.

2 participants