-
Notifications
You must be signed in to change notification settings - Fork 283
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Defaults shouldn't override previously set variables #210
Conversation
Thanks @kdonovan! This looks good to me. @jondeandres can you review as well? |
@brianr it's nice for me. |
Defaults shouldn't override previously set variables
Merge, thanks @kdonovan! Will get this out in the next release. |
Released in 1.4.3 (now on rubygems) |
This is breaking deploys for me. The problem is that by the time the Rollbar @kdonovan How/where are you loading the Rollbar access token ENV variable? |
I've detected the problem here.
We can do something crazy like @kdonovan could you provide us the loading order you have when setting It seems you are setting My suggestion is change that order, and we'll then revert this PR since it's being a problem for most of the users. |
@kdonovan I could reproduce your problem with this code task :foo do
set :rollbar_token, proc { 'foo' }
end
before 'load:defaults', 'foo' Are you using something similar? In that case 'load:defaults' will override your values. We can fix this for everybody with this code: namespace :load do
task :defaults do
set :rollbar_user, Proc.new { ENV['USER'] || ENV['USERNAME'] } unless fetch(:rollbar_user)
set :rollbar_env, Proc.new { fetch :rails_env, 'production' } unless fetch(:rollbar_env)
set :rollbar_token, Proc.new { abort "Please specify the Rollbar access token, set :rollbar_token, 'your token'" } unless fetch(:rollbar_token)
set :rollbar_role, Proc.new { :app } unless fetch(:rollbar_role)
end
end But probably the best is just not set anything before 'load:defaults' is executed, https://github.com/capistrano/capistrano/blob/master/lib/capistrano/setup.rb#L13. |
In our application we set the rollbar_token from environmental variables for security, but when rollbar loads itself up it blows away the already-set variables with it's defaults.