I've switched to using environment variables for configuration and it works very well - except when I have to deploy or run tasks with capistrano.
Capistrano 3 seems to execute each command prefixed with /usr/bin/env
which erases any environment variables I've set through .bashrc
.
EDIT - on doing some more reasearch, this might not be the issue, the issue might be because capistrano executes as a non-login, non-interactive shell and does not load .bashrc
or .bash_profile
. Still stuck, though.
What would be the best way of making sure the environment vars are set when capistrano executes its tasks?
No, you don't need to restart your system. However, you have to restart your command prompt application to update the changes done on Environment variables. Save this answer.
In Cypress, "environment variables" are variables that are accessible via Cypress. env . These are not the same as OS-level environment variables. However, it is possible to set Cypress environment variables from OS-level environment variables.
If you set an environment variable with the SET command in a command interpreter, it applies right there and then, to that process' environment. No rebooting, no logging off and on — nothing more required. The environment variables that are held in the registry are not, in fact, environment variables at all.
You might be best looking at the difference between ENVIRONMENT VARIABLES
and SHELL VARIABLES
When you fire SSH, your app will load the SHELL variables which are defined in your .bashrc
file. These only exist for the life of the shell, and therefore, we don't use them as much as ENV
vars
You may be better putting the ENV
vars in:
/etc/environment
Like this:
export ENVIRONMENT_VAR=value
This will make the variables available throughout the system, not just in different shell sessions
Update
Have you tried
Capistrano: Can I set an environment variable for the whole cap session?
set :default_env, { 'env_var1' => 'value1', 'env_var2' => 'value2' }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With