From d68c1ad974edd52264d4202199f0133df0e6c82f Mon Sep 17 00:00:00 2001 From: Benjamin Neff Date: Tue, 14 Jun 2016 06:40:34 +0200 Subject: [PATCH] remove REDISTOGO_URL deprecation --- config/defaults.yml | 3 +-- config/diaspora.yml.example | 4 ++-- lib/configuration_methods.rb | 25 +++++++------------------ spec/lib/configuration_methods_spec.rb | 13 ------------- 4 files changed, 10 insertions(+), 35 deletions(-) diff --git a/config/defaults.yml b/config/defaults.yml index bb9da9c1b..b60a9e20b 100644 --- a/config/defaults.yml +++ b/config/defaults.yml @@ -193,8 +193,6 @@ defaults: scope: tags include_user_tags: false pod_tags: - # List valid environment variables - redistogo_url: development: environment: @@ -243,6 +241,7 @@ integration1: integration2: environment: url: 'http://localhost:34658/' + redis: 'redis://localhost:6380' single_process_mode: true assets: serve: true diff --git a/config/diaspora.yml.example b/config/diaspora.yml.example index 46fa7385e..48769ed30 100644 --- a/config/diaspora.yml.example +++ b/config/diaspora.yml.example @@ -669,8 +669,8 @@ configuration: ## Section ## to have them different in different environments. production: ## Section environment: ## Section - #redis_url: 'redis://production.example.org:6379' + #redis: 'redis://production.example.org:6379' development: ## Section environment: ## Section - #redis_url: 'redis://production.example.org:6379' + #redis: 'redis://production.example.org:6379' diff --git a/lib/configuration_methods.rb b/lib/configuration_methods.rb index c751a7a97..6d5c1f503 100644 --- a/lib/configuration_methods.rb +++ b/lib/configuration_methods.rb @@ -102,25 +102,14 @@ module Configuration end def get_redis_options - if redistogo_url.present? - warn "WARNING: using the REDISTOGO_URL environment variable is deprecated, please use REDIS_URL now." - ENV['REDIS_URL'] = redistogo_url + redis_url = ENV["REDIS_URL"] || environment.redis.get + + return {} unless redis_url.present? + + unless redis_url.start_with?("redis://", "unix:///") + warn "WARNING: Your redis url (#{redis_url}) doesn't start with redis:// or unix:///" end - - redis_options = {} - - redis_url = ENV['REDIS_URL'] || environment.redis.get - - if ENV['RAILS_ENV']== 'integration2' - redis_options[:url] = "redis://localhost:6380" - elsif redis_url.present? - unless redis_url.start_with?("redis://") || redis_url.start_with?("unix:///") - warn "WARNING: Your redis url (#{redis_url}) doesn't start with redis:// or unix:///" - end - redis_options[:url] = redis_url - end - - redis_options + {url: redis_url} end def sidekiq_log diff --git a/spec/lib/configuration_methods_spec.rb b/spec/lib/configuration_methods_spec.rb index 452fbfe24..3783f3fc3 100644 --- a/spec/lib/configuration_methods_spec.rb +++ b/spec/lib/configuration_methods_spec.rb @@ -152,19 +152,8 @@ describe Configuration::Methods do end describe "#get_redis_options" do - context "with REDISTOGO_URL set" do - before do - ENV["REDISTOGO_URL"] = "redis://myserver" - end - - it "uses that" do - expect(@settings.get_redis_options[:url]).to match "myserver" - end - end - context "with REDIS_URL set" do before do - ENV["REDISTOGO_URL"] = nil ENV["REDIS_URL"] = "redis://yourserver" end @@ -175,7 +164,6 @@ describe Configuration::Methods do context "with redis set" do before do - ENV["REDISTOGO_URL"] = nil ENV["REDIS_URL"] = nil @settings.environment.redis = "redis://ourserver" end @@ -187,7 +175,6 @@ describe Configuration::Methods do context "with a unix socket set" do before do - ENV["REDISTOGO_URL"] = nil ENV["REDIS_URL"] = nil @settings.environment.redis = "unix:///tmp/redis.sock" end