-
Notifications
You must be signed in to change notification settings - Fork 631
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
.env load behaviour at odds with dotenv #702
Comments
I can't even get my processes to start with |
Nevermind, I had an old version of foreman somehow... but I'm still +1 on this and #711 :-) |
@PhilT Is this still an issue? |
@andrewmcodes Take a look at the referenced PR above. There is a workaround. |
The workaround mentioned in #711 is to pass the I wonder if we can improve it by adding some sort of sticky configuration to disable |
Added the "dotenv" gem to the "Gemfile" (the "dotenv-rails" gem is no longer needed -- we can use "dotenv" directly). Added "env_example" and ".env.development" files from the legacy Archelon. Modified the ".gitignore" file as in legacy Archelon to enable the ".env.development" file to be included in Git. Rails 7.1 uses the “foreman” gem to run the asset pipeline watchers and the Rails server, via the “bin/dev” script. As described in <ddollar/foreman#702>, “foreman” and the “dotenv” gem conflict when reading in the environment variables (any environment variables in the CLI environment are ignored, instead of overriding the variables in the various “.env” files). Used the workaround of adding `--env=/dev/null` to the “foreman” command in the “bin/dev” script so that the CLI environment variables and “.env” files will work as expected (i.e., that the CLI environment variables take precedence over the “.env” files). https://umd-dit.atlassian.net/browse/LIBFCREPO-1471
Added the "dotenv" gem to the "Gemfile" (the "dotenv-rails" gem is no longer needed -- we can use "dotenv" directly). Added "env_example" and ".env.development" files from the legacy Archelon. Modified the ".gitignore" file as in legacy Archelon to enable the ".env.development" file to be included in Git. Rails 7.1 uses the “foreman” gem to run the asset pipeline watchers and the Rails server, via the “bin/dev” script. As described in <ddollar/foreman#702>, “foreman” and the “dotenv” gem conflict when reading in the environment variables (any environment variables in the CLI environment are ignored, instead of overriding the variables in the various “.env” files). Used the workaround of adding `--env=/dev/null` to the “foreman” command in the “bin/dev” script so that the CLI environment variables and “.env” files will work as expected (i.e., that the CLI environment variables take precedence over the “.env” files). https://umd-dit.atlassian.net/browse/LIBFCREPO-1471
With dotenv if you have a var in
.env
and also have an environment variable of the same name it will use the environment variable over the.env
defined one. This allows you to define a.env
but then override it in certain environments with environment variables.With foreman, however, it seems
.env
always overrides any environment variables. I think it makes sense to mirror what dotenv does.For my specific use case I'm running up foreman within a docker container to start some sidekiq processes as well as the app server. However, as the
.env
contains aMQ_HOST
var oflocalhost
I can't override it in the environment of thedocker-compose.yml
to point to the rabbitmq docker service as would be expected when executing the command directly.This allows a default local development configuration as well as a docker based development config.
The text was updated successfully, but these errors were encountered: