0

我使用 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
4

1 回答 1

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
于 2012-04-14T18:06:33.973 回答