Skip to content

Commit

Permalink
Consolidated and restructured the settings file.
Browse files Browse the repository at this point in the history
  • Loading branch information
srobbin committed Feb 2, 2013
1 parent f5906bc commit 434b2bc
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
/tmp

# Local settings
/config/settings_development.yml
/config/settings.yml

# Misc
.DS_Store
2 changes: 1 addition & 1 deletion app/models/submission.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def create_service_request
lat, long = Geocoder.coordinates("#{self.restaurant_address} , Chicago, IL")

HTTParty.post('http://test311api.cityofchicago.org/open311/v2/requests.json', :body => {
:api_key => SETTINGS["311_api_key"],
:api_key => SETTINGS["OPEN_311_KEY"],
:service_code => '4fd6e4ece750840569000019',
:attribute => {
:PLEASESE => 'FOODPOIS',
Expand Down
4 changes: 3 additions & 1 deletion config/initializers/settings.rb
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
SETTINGS = YAML.load_file("#{Rails.root}/config/settings_#{Rails.env}.yml")
# Load the settings file, or grab them from ENV
settings_file = "#{Rails.root}/config/settings.yml"
SETTINGS = File.exist?(settings_file) ? YAML.load_file(settings_file) : ENV
8 changes: 4 additions & 4 deletions config/initializers/twitter.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Twitter.configure do |config|
config.consumer_key = SETTINGS["twitter"]["consumer_key"]
config.consumer_secret = SETTINGS["twitter"]["consumer_secret"]
config.oauth_token = SETTINGS["twitter"]["access_token"]
config.oauth_token_secret = SETTINGS["twitter"]["access_secret"]
config.consumer_key = SETTINGS["TWITTER_CONSUMER_KEY"]
config.consumer_secret = SETTINGS["TWITTER_CONSUMER_SECRET"]
config.oauth_token = SETTINGS["TWITTER_ACCESS_TOKEN"]
config.oauth_token_secret = SETTINGS["TWITTER_ACCESS_SECRET"]
end
10 changes: 10 additions & 0 deletions config/settings.yml.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# SETTINGS
# Copy the contents of file into a new file named "settings.yml",
# and fill in your Open 311 and Twitter API keys

OPEN_311_KEY: <insert 311 api key here>

TWITTER_CONSUMER_KEY: <insert consumer key here>
TWITTER_CONSUMER_SECRET: <insert consumer secret here>
TWITTER_ACCESS_TOKEN: <insert access token here>
TWITTER_ACCESS_SECRET: <insert access secret here>
6 changes: 0 additions & 6 deletions config/settings_development.yml.example

This file was deleted.

6 changes: 0 additions & 6 deletions config/settings_production.yml

This file was deleted.

0 comments on commit 434b2bc

Please sign in to comment.