这些figaro配置设置是否适用于heroku部署?

时间:2013-12-09 18:02:47

标签: ruby-on-rails facebook ruby-on-rails-3 heroku ruby-on-rails-4

所以,我正在使用Figaro存储我的秘密推特和Facebook oauth密钥,以便我可以正确地部署到Heroku。我想确认我做得对。

在我的application.yml中(由figaro生成):

// Add application configuration variables here, as shown below.
//

// PUSHER_APP_ID: "2954"
// PUSHER_KEY: 7381a978f7dd7f9a1117
// PUSHER_SECRET: abdc3b896a0ffb85d373
// STRIPE_API_KEY: EdAvEPVEC3LuaTg5Q3z6WbDVqZlcBQ8Z
// STRIPE_PUBLIC_KEY: pk_BRgD57O8fHja9HxduJUszhef6jCyS
// note these are arbitrary keys for the stack overflow

FR_FACEBOOK_KEY=1231231233123123
FR_FACEBOOK_SECRET=3123123123123
TWITTER_CONSUMER_KEY=12312312312312
TWITTER_CONSUMER_SECRET=1312312312312

那就是application.yml,然后我只需要运行:

 heroku config:add FR_FACEBOOK_KEY=8926 // and so on...

正确?

或者我错过了什么?

先谢谢!

当我运行rake figaro:heroku我收到了这个错误:

[new_work]$rake figaro:heroku
rake aborted!
undefined method `reject' for #<String:0x007fbdc6c0e2a8>
/usr/local/rvm/gems/ruby-2.0.0-p247/gems/figaro-0.7.0/lib/figaro.rb:39:in `flatten'
/usr/local/rvm/gems/ruby-2.0.0-p247/gems/figaro-0.7.0/lib/figaro.rb:17:in `env'
/usr/local/rvm/gems/ruby-2.0.0-p247/gems/figaro-0.7.0/lib/figaro/railtie.rb:7:in `block in <class:Railtie>'
/usr/local/rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0.rc1/lib/active_support/lazy_load_hooks.rb:36:in `call'
/usr/local/rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0.rc1/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
/usr/local/rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0.rc1/lib/active_support/lazy_load_hooks.rb:45:in `block in run_load_hooks'
/usr/local/rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0.rc1/lib/active_support/lazy_load_hooks.rb:44:in `each'
/usr/local/rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0.rc1/lib/active_support/lazy_load_hooks.rb:44:in `run_load_hooks'
/usr/local/rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0.rc1/lib/rails/application.rb:67:in `inherited'
/Users/usr/Sites/new_work/config/application.rb:22:in `<module:Friendiose>'
/Users/usr/Sites/new_work/config/application.rb:21:in `<top (required)>'
/Users/usr/Sites/new_work/Rakefile:5:in `require'
/Users/usr/Sites/new_work/Rakefile:5:in `<top (required)>'
/usr/local/rvm/gems/ruby-2.0.0-p247/bin/ruby_executable_hooks:15:in `eval'
/usr/local/rvm/gems/ruby-2.0.0-p247/bin/ruby_executable_hooks:15:in `<main>'
(See full trace by running task with --trace)

1 个答案:

答案 0 :(得分:8)

请务必使用:代替=来分隔您的键和值。您可以使用ENV["KEY_NAME"]

从rails应用访问密钥

但是,如果您有费加罗,则不必使用heroku config:add个密钥,只需使用rake figaro:heroku,如此处所述https://github.com/laserlemon/figaro