Skip to content

Commit feaa831

Browse files
committed
Ensure redis_url is set properly
1 parent e3a690b commit feaa831

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

config/application.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,11 @@ def self.merge_config(default_config, config, current_path = '')
7474

7575
Config = OpenStruct.new(tess_config)
7676

77-
Config.redis_url = TeSS::Config.redis_url
77+
Config.redis_url = if Rails.env.test?
78+
'redis://127.0.0.1:6379/0' # This URL required to talk to "fakeredis"
79+
else
80+
ENV.fetch('REDIS_URL') { 'redis://localhost:6379/1' }
81+
end
7882

7983
config_file = File.join(Rails.root, 'config', 'ingestion.yml')
8084
Config.ingestion = YAML.safe_load(File.read(config_file)).deep_symbolize_keys! if File.exist?(config_file)

test/unit/config_test.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
require 'test_helper'
22

33
class ConfigTest < ActiveSupport::TestCase
4-
54
test 'should load test secrets' do
65
assert_equal 'test', Rails.application.secrets.oidc[:client_id]
76
end
@@ -20,4 +19,7 @@ class ConfigTest < ActiveSupport::TestCase
2019
assert_equal 'TTI', TeSS::Config.site['title_short']
2120
end
2221

22+
test 'redis URL should be set' do
23+
assert_equal 'redis://127.0.0.1:6379/0', TeSS::Config.redis_url
24+
end
2325
end

0 commit comments

Comments
 (0)