Skip to content

Commit

Permalink
Add redis configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
maxkadel committed May 24, 2023
1 parent 6e60d5c commit fbb3d2c
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

# Named 01_orangelight_config.rb to force it to load before the mini_profiler.rb, which depends on it
module Orangelight
def config
@config ||= config_yaml.with_indifferent_access
Expand Down
6 changes: 5 additions & 1 deletion config/initializers/mini_profiler.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# frozen_string_literal: true

Rack::MiniProfiler.config.storage_options = { host: '127.0.0.1', port: '55212' }
Rack::MiniProfiler.config.storage_options = {
host: Orangelight.config[:redis][:host],
port: Orangelight.config[:redis][:port],
db: Orangelight.config[:redis][:db]
}
Rack::MiniProfiler.config.storage = Rack::MiniProfiler::RedisStore
2 changes: 1 addition & 1 deletion config/initializers/sneakers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

require 'sneakers'
require 'sneakers/handlers/maxretry'
require_relative 'orangelight_config'
require_relative '01_orangelight_config'
Sneakers.configure(
amqp: Orangelight.config['events']['server'],
exchange: Orangelight.config['events']['exchange'],
Expand Down
28 changes: 28 additions & 0 deletions config/orangelight.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ defaults: &defaults
report_harmful_language_form:
to: <%= ENV['OL_HARMFUL_CONTENT_TO'] %>
firestone_locator_base_url: https://locator-prod.princeton.edu
redis:
host: 'localhost'
port: '6379'
db: 'orangelight_default'
show_page:
linked_documents:
maximum: 3
Expand All @@ -22,6 +26,10 @@ development:
<<: *defaults
ask_a_question_form:
to: 'test-question@princeton.edu'
redis:
host: <%= ENV['lando_orangelight_redis_conn_host'] %>
port: <%= ENV['lando_orangelight_redis_conn_port'] %>
db: 'orangelight_dev'
suggest_correction_form:
to: 'test-correction@princeton.edu'
report_harmful_language_form:
Expand All @@ -33,31 +41,51 @@ test:
cc: 'test2w@princeton.edu, test3@princeton.edu'
ask_a_question_form:
to: 'test-question@princeton.edu'
redis:
host: <%= ENV['lando_orangelight_redis_conn_host'] %>
port: <%= ENV['lando_orangelight_redis_conn_port'] %>
db: 'orangelight_test'
suggest_correction_form:
to: 'test-correction@princeton.edu'
report_harmful_language_form:
to: 'test-harmful-content@princeton.edu'

production:
<<: *defaults
redis:
host: <%= ENV['ORANGELIGHT_REDIS_HOST'] %>
port: <%= ENV['ORANGELIGHT_REDIS_PORT'] || '6379' %>
db: 'orangelight_prod'
events:
server: <%= ENV['OL_RABBIT_SERVER'] || 'amqp://localhost:5672' %>
exchange: 'orangelight_events'

staging:
<<: *defaults
redis:
host: <%= ENV['ORANGELIGHT_REDIS_HOST'] %>
port: <%= ENV['ORANGELIGHT_REDIS_PORT'] || '6379' %>
db: 'orangelight_staging'
events:
server: <%= ENV['OL_RABBIT_SERVER'] || 'amqp://localhost:5672' %>
exchange: 'orangelight_events'
firestone_locator_base_url: https://locator-staging.princeton.edu

alma_qa:
<<: *defaults
redis:
host: <%= ENV['ORANGELIGHT_REDIS_HOST'] %>
port: <%= ENV['ORANGELIGHT_REDIS_PORT'] || '6379' %>
db: 'orangelight_alma_qa'
events:
server: <%= ENV['OL_RABBIT_SERVER'] || 'amqp://localhost:5672' %>
exchange: 'orangelight_events'
qa:
<<: *defaults
redis:
host: <%= ENV['ORANGELIGHT_REDIS_HOST'] %>
port: <%= ENV['ORANGELIGHT_REDIS_PORT'] || '6379' %>
db: 'orangelight_qa'
events:
server: <%= ENV['OL_RABBIT_SERVER'] || 'amqp://localhost:5672' %>
exchange: 'orangelight_events'

0 comments on commit fbb3d2c

Please sign in to comment.