gpt4 book ai didi

ruby-on-rails - 这些 figaro 配置设置是否适合 heroku 部署?

转载 作者:行者123 更新时间:2023-12-04 05:36:31 28 4
gpt4 key购买 nike

所以,我正在使用 Figaro存储我的 secret twitter 和 Facebook oauth key ,以便我可以正确部署到 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)

最佳答案

请记住使用 : 而不是 = 来分隔键和值。您可以使用 ENV["KEY_NAME"]

从您的 Rails 应用访问 key

但是,当您拥有 Figaro 时,您不必 heroku config:add 键,只需使用 rake figaro:heroku 即可,如此处所述 https://github.com/laserlemon/figaro

关于ruby-on-rails - 这些 figaro 配置设置是否适合 heroku 部署?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20477458/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com