about summary refs log tree commit diff
path: root/config/initializers
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-11-07 23:20:52 +0100
committerEugen Rochko <eugen@zeonfederated.com>2016-11-07 23:20:52 +0100
commitdbe00a4156952cf0288828435ccda6bbba5d7a6f (patch)
treecf2bbd8184db9b47db1aa62cb4b93c49b7aa90a7 /config/initializers
parent0400734df7a38f4b100d601eb8cffd7cd9689c76 (diff)
Improved configuration from ENV, cleaned up timeline filter methods
to be more readable, add extra logging to process feed service
Diffstat (limited to 'config/initializers')
-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
4 files changed, 13 insertions, 7 deletions
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 }