How to set environment variables in Capistrano 3?

In Capistrano 2, you can do something like this:

set :default_environment, { 'PATH' => 'PATH=$PATH:/opt/rubies/ruby-2.1.1/bin' } 

Is there an equivalent in cap 3?

+8
ruby ruby-on-rails capistrano3
source share
2 answers

using:

 set :default_env, { 'PATH' => 'PATH=$PATH:/opt/rubies/ruby-2.1.1/bin' } 

at least capistrano 3.1

+15
source share

Perhaps a little late, but ...

Capistrano 3 uses specia syntax for the environment

 on roles :app do with some_env: "foobar" do ... end end 

In the above example, inside the block with / end capistrano sets the environment variable SOME_ENV to "foobar"

see https://github.com/capistrano/sshkit#users-working-directories-environment-variables-and-umask

0
source share

All Articles