2

因此,我使用Figaro來存儲我的祕密推特和Facebook oauth密鑰,以便我可以正確部署到Heroku。我只想確認我做對了。這些figaro配置設置是否適用於heroku部署?

在我application.yml(由費加羅生成):

// 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... 

是否正確?

或者我錯過了什麼?

感謝先進!

當我運行耙費加羅: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) 

回答

8

記住使用:而不是=來分隔鍵和值。您可以使用ENV["KEY_NAME"]

但是訪問您的Rails應用程序鍵,你不必heroku config:add鍵,而你有費加羅,只要使用rake figaro:heroku

+0

感謝這裏https://github.com/laserlemon/figaro解釋@Andreas當我運行瑞克命令我得到一個錯誤,我已經更新了它的帖子。 –

+0

明白了,我在我的XML中有錯誤的語法.. –

+1

啊,是的,我只是注意到你有'='而不是':':P,是嗎? –

相關問題