2012-04-13 78 views
0

我使用Pit开发了一个Rails 3.2应用程序。它在我的本地盒子里工作。我想在Heroku上部署它,但我不知道如何设置配置。请告诉我。如何设置对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 

回答

0

我放弃了使用坑反对的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