-
Notifications
You must be signed in to change notification settings - Fork 632
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
Variables in .env file no longer evaluated #561
Comments
I've encountered this too in version 0.78.0. |
+1 |
1 similar comment
+1 |
Dotenv was removed as a foreman dependency prior to version 0.78.0, and foreman now has its own If you're using Dotenv programmatically, you can use the Alternately, you can stop foreman from doing any of its own environment loading by having it read from an empty file (if you specify any
The There was some discussion about vendoring Dotenv rather than removing it, but that didn't seem to make it in before Dotenv was completely excised. For what it's worth, I'm in favor of having foreman's env loader do variable interpolation — either by vendoring Dotenv or simply mimicking the behavior — but the authors may consider this an edge case that does not need to be supported, so these workarounds may be necessary for the foreseeable future unless someone takes up that cause (and/or effort). |
I am not sure if this is right place, but sadly foreman 0.78 is not usable for me as it was before with 0.76. Before upgrading I created files to define my ENV vars with a bash-like syntax. That's the way how I passed my ENV vars to a Rails application, but also to some bash-scripts (source- aka. .-command) and other application (parsing line by line). This file (I called it development.env) may looked like this:
Which enabled me to pass that ENV vars like this:
With foremand 0.78 this procedure seems to have changed, because when running things like above I only receive..
Did I misused foreman or is this a bug or does that feature (passing env files to foreman) do not even exist anymore? |
@mgrobelin I had the same problem after upgrading to 0.78. You can fix it by adding the
|
@YoranBrondsema thanks for pointing this out - it makes sense to place arguments directly after run-command. Sadly this just solves the invalid option message, but do not pick up my ENV vars :( 0.76:
0.78:
After spending some time I guess, that envfile of 0.78 follows different conventions than it was true for the versions before:
Example:
Is it possible to make those two expectations true again? It's necessary for my use case to have an envfile that is bash-(alike)-conform. |
easy fix I use for run is:
|
If you want to restore the old behavior : Create a
And in |
Still no news on this?! |
If anyone that is being affected by this would like to submit a PR I would be grateful. Thank you! My time is currently quite limited so I will likely not be addressing non-critical issues for quite some time. |
Foreman is currently only reading static env vars out of a |
This problem bit us inadvertently. We use Dotenv in our Rails installation and we had a .env with
When we ran in development no issues. But when we introduced foreman, really strange things began to happen. until we found this finally during debugging:
If you are going to play with .env files, you need to treat them like Dotenv treats them. |
The main problem I see is that the current version of Foreman makes it impossible to also use Dotenv, and Foreman does not let you turn off environment processing easily. The easiest workaround seems to be the What I would suggest is adding a |
my servic in systemctl
How do I make it so?
Error if Environment one line
|
Variable interpolation and comments in the .env file are not "nice-to-haves," they're requirements. I can get by without them in toy projects or prototypes, but not in a mature codebase with dozens of environment variables that need to be understood and kept in sync. Fortunately, the solution is straightforward:
|
Dotenv is a zero-dependency library. Isn't time to consider adding it as a dependency again or, at least, update the vendorized version of it? |
Something changed from 0.76.0 to 0.78.0. For an .env file like:
PIES=yummy
CAKES=$PIES
The loaded values are:
ENV['CAKES'] == "yummy"
in 0.76.0ENV['CAKES'] == "$PIES"
in 0.78.0Dotenv (1.0.2) seems to be doing its job properly, but
Dotenv.load
doesn't overwrite existing keys, which already have the un-evaluated variables from Foreman. I've only looked into it far enough to see at this point: https://github.com/ddollar/foreman/blob/master/lib/foreman/cli.rb#L88,engine.env
is correct in 0.76.0, but incorrect in 0.78.0.The text was updated successfully, but these errors were encountered: