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

Support .env.template if no .env.sample #65

Merged
merged 4 commits into from
Jun 19, 2023
Merged

Conversation

arielj
Copy link
Contributor

@arielj arielj commented Jun 15, 2023

  • Add an entry to CHANGELOG.md that links to this PR under the "main (unreleased)" heading.

Description:

This PRs adds a fallback to also support .env.template if .env.sample is not present. The .env.template file is created by dotenv itself when using the dotenv -t .env command, so it's important to support it since many users of dotenv could be using that instead of .env.sample. https://github.com/bkeepers/dotenv/tree/master#should-i-commit-my-env-file

This fixes #63

I had to refactor the tests a big to be able to test this better.

I will abide by the code of conduct.

@@ -73,15 +73,19 @@ For more information check this [page](https://docs.docker.com/compose/environme
The workaround is to rename your `.env` file when using docker. [Here](https://github.com/bkeepers/dotenv#what-other-env-files-can-i-use) you'll find all naming options acceptable for dotenv and that Docker will not automatically parse.

If renaming is not an option, then you need to remove any comments or trailing whitespaces from your `.env` file:

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sorry, below this line it was just the formatter in this file, I can remove that if needed

@@ -4,13 +4,18 @@
let(:sample_lines) { StringIO.new("") }

before do
allow(File).to receive(:exist?).and_return(true)
Copy link
Member

Choose a reason for hiding this comment

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

👏

Copy link
Member

@etagwerker etagwerker left a comment

Choose a reason for hiding this comment

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

@arielj Looks good, thanks!

@etagwerker etagwerker merged commit 3ecffb9 into main Jun 19, 2023
11 checks passed
@etagwerker etagwerker deleted the support-template-file branch June 19, 2023 01:36
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.

[REQUEST] Support .env.template as an alternative to .env.sample
3 participants