如何针对Heroku设置Pit设置?

时间:2012-04-13 23:44:50

标签: ruby heroku

我使用Pit开发了一个Rails 3.2应用程序。它适用于我当地的包装盒。我想在Heroku上部署它,但我不知道如何设置配置。请告诉我。

这是我使用Pit的代码:

pit = Pit.get(
  'my_app',
  :require => {
    'twitter.consumer_key' => '',
    'twitter.consumer_secret' => '',
    'twitter.oauth_token' => '',
    'twitter.oauth_token_secret' => '',
})
Twitter.configure do |config|
  config.consumer_key       = pit["twitter.consumer_key"]
  config.consumer_secret    = pit["twitter.consumer_secret"]
  config.oauth_token        = pit["twitter.oauth_token"]
  config.oauth_token_secret = pit["twitter.oauth_token_secret"]
end

1 个答案:

答案 0 :(得分:0)

我放弃了使用Pit对抗Heroku。所以我使用环境变量。

pit = Pit.get(
  "my_app",
  :require => {
    "twitter.consumer_key"       => '', 
    "twitter.consumer_secret"    => '', 
    "twitter.oauth_token"        => '', 
    "twitter.oauth_token_secret" => '', 
})
pit["twitter.consumer_key"] ||= ENV["twitter.consumer_key"]
pit["twitter.consumer_secret"] ||= ENV["twitter.consumer_secret"]
pit["twitter.oauth_token"] ||= ENV["twitter.oauth_token"]
pit["twitter.oauth_token_secret"] ||= ENV["twitter.oauth_token_secret"]

Twitter.configure do |config|
  config.consumer_key       = pit["twitter.consumer_key"]
  config.consumer_secret    = pit["twitter.consumer_secret"]
  config.oauth_token        = pit["twitter.oauth_token"]
  config.oauth_token_secret = pit["twitter.oauth_token_secret"]
end