CR7
CR7

Reputation: 710

Always showing environment as production while deploying using capistrano

When I run the command cap staging deploy, then also it's producing the result as

puma:start
using conf file /var/www/rails/shared/tmp/puma.rb
01 ~/.rvm/bin/rvm default do bundle exec puma -C /var/www/rails/shared/tmp/puma.rb --daemon
01 Puma starting in single mode...
01 * Version 3.12.0 (ruby 2.5.0-p0), codename: Llamas in Pajamas
01 * Min threads: 0, max threads: 8
01 * Environment: production
01 * Daemonizing..

In deploy.rb file it has the following line

set :puma_env, fetch(:rack_env, fetch(:rails_env, 'production'))

If I change its value from production to any other value, then it is reflected there as well. Does this line has any effect in setting the deploy environment?

Upvotes: 0

Views: 547

Answers (1)

H Dox
H Dox

Reputation: 675

According to the docs, the second parameter of fetch will act as a default value for the first parameter if it has not been set yet.

As a result, if your deploy.rb file did not declare rails_env value then the value will become production as it is the default value.

You can override this behaviour by adding this line to your deploy.rb

set :rails_env, 'your_environment_here'

Upvotes: 2

Related Questions