Open fabiendv opened 1 week ago
this is working as expected. Kamal uses dotenv
under the hood, and being able to grab environment variables from an export is a default behavior.
this is working as expected. Kamal uses
dotenv
under the hood, and being able to grab environment variables from an export is a default behavior.
It can be surprising for developers when a value specified in .env.myenv
is not reflected on the host machine. I believe that variables in .env.myenv
should take precedence over terminal values.
However, if this behavior is indeed intended, let's close this issue.
There is an issue where the value of an environment variable set in the terminal is overwriting the value specified in the .env.erb file. The expected behavior is that the value defined in .env.erb should take precedence and overwrite any value set in the terminal.
Desired behavior
The value specified in the .env.erb file should overwrite the value set in the terminal.
How to Reproduce
Define a value in your .env.erb file:
In the terminal, export a different value for the same variable:
To make sure your terminal knows the value, you can edit the .bashrc.
Run the following command:
Check the value of the environment variable on the host machine (.kamal/env/roles/myfile.rb)
The environment variable on the host machine retains the terminal value (wrongvalue).
Expected outcome
The environment variable on the host machine should have the value from .env.erb (test).
Root cause
Version
Kamal 1.7.1