Closed abhinavc closed 1 year ago
You can override variables in your deploy.rb
script.
If you set:
# config/deploy.rb
require 'mina/rails'
set :rails_env, 'staging'
it will set the rails_env
variable to staging
(or rather, the value staging
will override the value production
).
Regarding deploying to multiple environments, see this code sample, and let me know if it helps.
Thanks @lovro-bikic
I realized after I filed the issue that set :rails_env, 'staging'
would work. I wrongly assumed that once set
a value could not be changed - not realizing that if set
is passed a block, then that block will be used by fetch
to return the updated value.
I am looking to deploy two instances of a Rails app on a VPS - one for production and one for sandbox (or staging / testing).
But it seems to me that
mina
wouldn't allow it.In task
rails:db_migrate
,rails_env
is hard-coded toproduction
with no means to override it. And thisrails_env
then percolates down tobundle_prefix
and thence torake
andrails
etc.Could a way be provided therefore to
set :rails_env
to something other than the defaultproduction
?