Commit 330f252f by David Ormsbee

Convert to Heroku config

parent 432a62d9
...@@ -48,3 +48,4 @@ group :test do ...@@ -48,3 +48,4 @@ group :test do
gem 'rack-test', :require => "rack/test" gem 'rack-test', :require => "rack/test"
end end
gem 'newrelic_rpm'
...@@ -99,6 +99,7 @@ GEM ...@@ -99,6 +99,7 @@ GEM
tzinfo (~> 0.3.22) tzinfo (~> 0.3.22)
moped (1.2.0) moped (1.2.0)
multi_json (1.3.6) multi_json (1.3.6)
newrelic_rpm (3.4.1)
nokogiri (1.5.5) nokogiri (1.5.5)
origin (1.0.6) origin (1.0.6)
pry (0.9.10) pry (0.9.10)
...@@ -166,6 +167,7 @@ DEPENDENCIES ...@@ -166,6 +167,7 @@ DEPENDENCIES
mongoid_magic_counter_cache! mongoid_magic_counter_cache!
mongoid_taggable_with_context! mongoid_taggable_with_context!
moped moped
newrelic_rpm
nokogiri nokogiri
pry pry
pry-nav pry-nav
......
...@@ -4,6 +4,10 @@ require 'bundler' ...@@ -4,6 +4,10 @@ require 'bundler'
Bundler.setup Bundler.setup
Bundler.require Bundler.require
Tire.configure do
url YAML.load_file("config/application.yml")['elasticsearch_server']
end
desc "Load the environment" desc "Load the environment"
task :environment do task :environment do
environment = ENV["SINATRA_ENV"] || "development" environment = ENV["SINATRA_ENV"] || "development"
......
require 'rubygems' require 'rubygems'
require 'bundler' require 'bundler'
require 'erb'
Bundler.setup Bundler.setup
Bundler.require Bundler.require
...@@ -17,9 +18,14 @@ module CommentService ...@@ -17,9 +18,14 @@ module CommentService
API_PREFIX = "/api/#{API_VERSION}" API_PREFIX = "/api/#{API_VERSION}"
end end
if environment == "staging" or environment == "production"
require 'newrelic_rpm'
end
set :cache, Dalli::Client.new set :cache, Dalli::Client.new
CommentService.config = YAML.load_file("config/application.yml").with_indifferent_access application_yaml = ERB.new(File.read("config/application.yml")).result()
CommentService.config = YAML.load(application_yaml).with_indifferent_access
Tire.configure do Tire.configure do
url CommentService.config[:elasticsearch_server] url CommentService.config[:elasticsearch_server]
......
level_limit: 3 level_limit: 3
cache_enabled: false cache_enabled: false
api_key: "PUT_YOUR_API_KEY_HERE" api_key: <%= ENV['API_KEY'] || 'PUT_YOUR_API_KEY_HERE' %>
elasticsearch_server: "http://localhost:9200" elasticsearch_server: <%= ENV['SEARCH_SERVER'] || 'http://localhost:9200' %>
cache_timeout: cache_timeout:
threads_search: 10 threads_search: 10
threads_query: 10 threads_query: 10
...@@ -12,23 +12,20 @@ test: ...@@ -12,23 +12,20 @@ test:
hosts: hosts:
- localhost:27017 - localhost:27017
staging2: production:
sessions: sessions:
default: default:
database: cs_comments_service_staging uri: <%= ENV['MONGOHQ_URL'] %>
hosts:
- alex.mongohq.com:10079
username: forum
password: forum
staging: staging:
sessions: sessions:
default: default:
database: cs_comments_service_staging uri: <%= ENV['MONGOHQ_URL'] %>
hosts:
- ds037047.mongolab.com:37047 loadtest:
username: forum sessions:
password: forum default:
uri: <%= ENV['MONGOHQ_URL'] %>
defaults: &defaults defaults: &defaults
use_utc: false use_utc: false
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment