Skip to content

Commit

Permalink
各環境で接続するelascticsearchを指定する
Browse files Browse the repository at this point in the history
  • Loading branch information
suusan2go committed Feb 14, 2016
1 parent 8e707c0 commit f2e2c0b
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,6 @@
# Use an evented file watcher to asynchronously detect changes in source code,
# routes, locales, etc. This feature depends on the listen gem.
# config.file_watcher = ActiveSupport::EventedFileUpdateChecker

config.elasticsearch_host = ENV['ELASTICSEARCH_URL'] || 'http://127.0.0.1:9200'
end
2 changes: 2 additions & 0 deletions config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,6 @@
authentication: 'plain',
enable_starttls_auto: true
}

config.elasticsearch_host = ENV['ELASTICSEARCH_URL'] || 'http://127.0.0.1:9200'
end
2 changes: 2 additions & 0 deletions config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,6 @@

# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true

config.elasticsearch_host = ENV['ELASTICSEARCH_URL'] || 'http://127.0.0.1:9250'
end
2 changes: 2 additions & 0 deletions config/initializers/elasticsearch.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Elasticsearch::Model.client =
Elasticsearch::Client.new(host: Rails.application.config.elasticsearch_host)
2 changes: 0 additions & 2 deletions spec/rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,4 @@
config.after(:suite) do
Elasticsearch::Extensions::Test::Cluster.stop
end
end
end
end

0 comments on commit f2e2c0b

Please sign in to comment.