Description
IMPORTANT: please make sure you ask yourself all intro questions and fill all sections of the template.
Before we start...:
- I checked the documentation and found no answerI checked to make sure that this issue has not already been filedI'm reporting the issue to the correct repository (for multi-repository projects)
Expected behavior:
Create a Rails app using this template.
Add ENV to the .env.sample file.
And be able to run the app with foreman or docker.
Actual behavior:
Running a newly created app (based on this template) does not run in docker or foreman.
Steps to reproduce:
- I create a rails app using this template.
- I add a few ENV entries into the .env.sample file.
- Then I run the setup script.
- Then I try to run the app in docker or with foreman.
- But the app does fails to run.
Context and environment:
From this issue: fastruby/dotenv_validator#46
And this PR: fastruby/dotenv_validator#51
The issue was that foreman and docker-compose would automatically parse any .env files present in the project and populate the environment variables before the Rails app could run, but with no treatment of comments and blank spaces. As a result, when dotenv parsed the file, since the variables would already be populated by docker, it would not change them and, because of this, dotenv_validator validated environment variables that included any blank spaces or comments present in the .env files.
This caused dotenv_validator to fail even for environment variables that should pass.
More details can be found in the changes to the README of dotenv_validator here. After this change we can now successfully run the app in docker and locally with foreman without dotenv_validator failing.
We want to make these changes:
Add this to .gitignore
.env.local
.env.test
Add to bin/setup
unless File.exist?(".env.local")
cp ".env.sample", ".env.local"
system! "ln -s .env.local .env.test"
end
I will abide by the [code of conduct] (CODE_OF_CONDUCT.md)
Activity
arielj commentedon Dec 9, 2021
I'm not sure if this is needed here, the rails-template does not reference foreman anywhere. I guess it makes sense if we first make the rails-template create the docker-compose or forman configs.
fbuys commentedon Dec 10, 2021
Sure @arielj that makes sense.
I thought making this change could be useful because it works without docker-compose or foreman.
Do you think there is a reason not to make use of the .local and .test whether we introduce docker-compose or foreman now?