manage app config vars
config:get KEY display a config value for an app
Examples:
$ heroku config:get A one
# File lib/heroku/command/config.rb, line 94 def get unless key = shift_argument error("Usage: heroku config:get KEY\nMust specify KEY.") end validate_arguments! vars = api.get_config_vars(app).body key, value = vars.detect {|k,v| k == key} display(value.to_s) end
config display the config vars for an app -s, --shell # output config vars in shell format
Examples:
$ heroku config A: one B: two $ heroku config --shell A=one B=two
# File lib/heroku/command/config.rb, line 23 def index validate_arguments! vars = api.get_config_vars(app).body if vars.empty? display("#{app} has no config vars.") else vars.each {|key, value| vars[key] = value.to_s} if options[:shell] vars.keys.sort.each do |key| display(%Q{#{key}=#{vars[key]}}) end else styled_header("#{app} Config Vars") styled_hash(vars) end end end
config:set KEY1=VALUE1 [KEY2=VALUE2 ...] set one or more config vars
Example:
$ heroku config:set A=one Setting config vars and restarting myapp... done, v123 A: one $ heroku config:set A=one B=two Setting config vars and restarting myapp... done, v123 A: one B: two
# File lib/heroku/command/config.rb, line 57 def set unless args.size > 0 and args.all? { |a| a.include?('=') } error("Usage: heroku config:set KEY1=VALUE1 [KEY2=VALUE2 ...]\nMust specify KEY and VALUE to set.") end vars = args.inject({}) do |vars, arg| key, value = arg.split('=', 2) vars[key] = value vars end action("Setting config vars and restarting #{app}") do api.put_config_vars(app, vars) @status = begin if release = api.get_release(app, 'current').body release['name'] end rescue Heroku::API::Errors::RequestFailed => e end end vars.each {|key, value| vars[key] = value.to_s} styled_hash(vars) end
config:unset KEY1 [KEY2 …]
unset one or more config vars
$ heroku config:unset A Unsetting A and restarting myapp… done, v123
$ heroku config:unset A B Unsetting A and restarting myapp… done, v123 Unsetting B and restarting myapp… done, v124
# File lib/heroku/command/config.rb, line 116 def unset if args.empty? error("Usage: heroku config:unset KEY1 [KEY2 ...]\nMust specify KEY to unset.") end args.each do |key| action("Unsetting #{key} and restarting #{app}") do api.delete_config_var(app, key) @status = begin if release = api.get_release(app, 'current').body release['name'] end rescue Heroku::API::Errors::RequestFailed => e end end end end