Skip to content
This repository has been archived by the owner on Mar 30, 2021. It is now read-only.

Commit

Permalink
herokuのREDIS_URLは認証付きで複雑なのでスキーマ込みで環境変数に渡す
Browse files Browse the repository at this point in the history
またredis-rbで無指定の場合の接続先も同環境変数を参照している
  • Loading branch information
tnmt committed Aug 29, 2017
1 parent 3b3aca4 commit c376b63
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 5 deletions.
1 change: 1 addition & 0 deletions .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ DATABASE_PASSWORD=
SLACK_API_KEY=
SLACK_API_SECRET=
SLACK_OAUTH_ACCESS_TOKEN=
REDIS_URL='redis://localhost:6379'
2 changes: 1 addition & 1 deletion config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module Answer
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 5.1
config.cache_store = :redis_store, "redis://#{Settings.redis.host}:6379/0/cache", { expires_in: 3.minutes }
config.cache_store = :redis_store, "#{ENV['REDIS_URL']}/0/cache", { expires_in: 3.minutes }
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
Expand Down
4 changes: 2 additions & 2 deletions config/initializers/sidekiq.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Sidekiq.configure_server do |config|
config.redis = { url: "redis://#{Settings.redis.host}:6379", namespace: 'sidekiq' }
config.redis = { url: ENV['REDIS_URL'], namespace: 'sidekiq' }
end

Sidekiq.configure_client do |config|
config.redis = { url: "redis://#{Settings.redis.host}:6379", namespace: 'sidekiq' }
config.redis = { url: ENV['REDIS_URL'], namespace: 'sidekiq' }
end
2 changes: 0 additions & 2 deletions config/settings.yml
Original file line number Diff line number Diff line change
@@ -1,2 +0,0 @@
redis:
host: 'localhost'

0 comments on commit c376b63

Please sign in to comment.