Reputation: 21775
I saw this Capistrano: Can I set an environment variable for the whole cap session?
And I am using this to set my variable
set :default_environment, self[:default_environment].
merge('PAYPAL_SANDBOX' => 'true')
I print self[:default_environment]
and I get PAYPAL_SANDBOX
correctly set
However, how could I test if rails server is running with that variable set?, I think is not working, because in another part I have
ENV['PAYPAL_SANDBOX'] ? 'development' : Rails.env
and I am getting into second part of this sentence, I mean is taking Rails.env
instead of development
Upvotes: 3
Views: 2203
Reputation: 33
My solution was like this:
Set global variable
set :my_number, 23
Get global variable
puts "My number is #{fetch(:my_number)}"
Upvotes: 0
Reputation: 21775
I solved it like this:
I created a file inside my server, just to mark it
touch test_server
Inside an initializer
TEST_SERVER = `ls ~/test_server`.present?
Then,
TEST_SERVER ? 'development' : Rails.env
Upvotes: 2