about summary refs log tree commit diff
path: root/config
diff options
context:
space:
mode:
Diffstat (limited to 'config')
-rw-r--r--config/environments/production.rb4
-rw-r--r--config/initializers/neography.rb4
-rw-r--r--config/initializers/ostatus.rb6
-rw-r--r--config/initializers/redis.rb6
-rw-r--r--config/initializers/sidekiq.rb4
5 files changed, 15 insertions, 9 deletions
diff --git a/config/environments/production.rb b/config/environments/production.rb
index f2071f7a2..27238e3d8 100644
--- a/config/environments/production.rb
+++ b/config/environments/production.rb
@@ -46,8 +46,8 @@ Rails.application.configure do
 
   # Use a different cache store in production.
   config.cache_store = :redis_store, {
-    host: ENV['REDIS_HOST'] || 'localhost',
-    port: ENV['REDIS_PORT'] || 6379,
+    host: ENV.fetch('REDIS_HOST') { 'localhost' },
+    port: ENV.fetch('REDIS_PORT') { 6379 },
     db: 0,
     namespace: 'cache'
   }
diff --git a/config/initializers/neography.rb b/config/initializers/neography.rb
index 25d54658b..bd6ead3b0 100644
--- a/config/initializers/neography.rb
+++ b/config/initializers/neography.rb
@@ -1,5 +1,5 @@
 Neography.configure do |config|
   config.protocol             = "http"
-  config.server               = ENV['NEO4J_HOST'] || 'localhost'
-  config.port                 = ENV['NEO4J_PORT'] || 7474
+  config.server               = ENV.fetch('NEO4J_HOST') { 'localhost' }
+  config.port                 = ENV.fetch('NEO4J_PORT') { 7474 }
 end
diff --git a/config/initializers/ostatus.rb b/config/initializers/ostatus.rb
index 383253cd4..3dd501b65 100644
--- a/config/initializers/ostatus.rb
+++ b/config/initializers/ostatus.rb
@@ -1,6 +1,8 @@
+port = ENV.fetch('PORT') { 3000 }
+
 Rails.application.configure do
-  config.x.local_domain = ENV['LOCAL_DOMAIN'] || "localhost:#{ENV['PORT'] || 3000}"
-  config.x.hub_url      = ENV['HUB_URL']      || 'https://pubsubhubbub.superfeedr.com'
+  config.x.local_domain = ENV.fetch('LOCAL_DOMAIN') { "localhost:#{port}" }
+  config.x.hub_url      = ENV.fetch('HUB_URL')      { 'https://pubsubhubbub.superfeedr.com' }
   config.x.use_https    = ENV['LOCAL_HTTPS'] == 'true'
   config.x.use_s3       = ENV['S3_ENABLED'] == 'true'
 
diff --git a/config/initializers/redis.rb b/config/initializers/redis.rb
index a4e4cfc48..4fe33811f 100644
--- a/config/initializers/redis.rb
+++ b/config/initializers/redis.rb
@@ -1 +1,5 @@
-$redis = Redis.new(host: ENV['REDIS_HOST'] || 'localhost', port: ENV['REDIS_PORT'] || 6379, driver: :hiredis)
+$redis = Redis.new({
+  host: ENV.fetch('REDIS_HOST') { 'localhost' },
+  port: ENV.fetch('REDIS_PORT') { 6379 },
+  driver: :hiredis
+})
diff --git a/config/initializers/sidekiq.rb b/config/initializers/sidekiq.rb
index 153173974..63fdb3f16 100644
--- a/config/initializers/sidekiq.rb
+++ b/config/initializers/sidekiq.rb
@@ -1,5 +1,5 @@
-host = ENV['REDIS_HOST'] || 'localhost'
-port = ENV['REDIS_PORT'] || 6379
+host = ENV.fetch('REDIS_HOST') { 'localhost' }
+port = ENV.fetch('REDIS_PORT') { 6379 }
 
 Sidekiq.configure_server do |config|
   config.redis = { host: host, port: port }