(This is NOT ABOUT OAUTH but about storing a key and a value)
I wrote a simple app that queries my twitter account and then process the tweets from my timeline.
I am able to obtain my oauth token and secret but as it turns out I can’t really store them on the filesystem on heroku for some unknown reason.
basically I have the following code:
task :heroku => :environment do
desc "manually store the keys for heroku in oauth_path"
File.open(oauth_path, 'w') do |f|
f.puts ENV['token']
f.puts ENV['secret']
end
puts "Token and Secrent written to #{oauth_path}"
end
this works on local filesystem but not on heroku.
I have a task which then opens oauth_path and then run the twitter app with those token and secret.
I have set up cron on heroku to execute rake myapp:pull
Any ideas how I can store the key value and then write my app as rake myapp:pull ??
You should set up an enviroment varible on heroku to store this information, it should not be stored inside a database since that could be potentially less secure.
You set keys like this:
And access them like this:
See the documentation for more info.