[feat]Config read from environment variables
This commit is contained in:
parent
b7fbba162b
commit
4fcc610b24
6 changed files with 22 additions and 8 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
DEFAULT_LOGO = Rails.configuration.conference[:default_logo]
|
DEFAULT_LOGO = Rails.configuration.conference[:default_logo_filename]
|
||||||
DEFAULT_COLOR = Rails.configuration.conference[:default_color]
|
DEFAULT_COLOR = Rails.configuration.conference[:default_color]
|
||||||
|
|
||||||
module ConferenceHelper
|
module ConferenceHelper
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
EMAIL_TEMPLATE = 'email_template'
|
||||||
|
|
||||||
SNAPCON_BCC_ADDRESS = Rails.configuration.mailbot[:bcc_address]
|
SNAPCON_BCC_ADDRESS = Rails.configuration.mailbot[:bcc_address]
|
||||||
EMAIL_TEMPLATE = Rails.configuration.mailbot[:email_template]
|
|
||||||
YTLF_TICKET_ID = Rails.configuration.mailbot[:ytlf_ticket_id]
|
YTLF_TICKET_ID = Rails.configuration.mailbot[:ytlf_ticket_id]
|
||||||
|
|
||||||
class Mailbot < ActionMailer::Base
|
class Mailbot < ActionMailer::Base
|
||||||
|
|
|
||||||
|
|
@ -67,15 +67,13 @@ module Osem
|
||||||
config.active_job.queue_adapter = :delayed_job
|
config.active_job.queue_adapter = :delayed_job
|
||||||
|
|
||||||
config.conference = {
|
config.conference = {
|
||||||
events_per_page: 3,
|
events_per_page: (ENV['EVENTS_PER_PAGE'] || 3),
|
||||||
default_logo: 'snapcon_logo.png',
|
default_logo_filename: (ENV['DEFAULT_LOGO_FILENAME'] || 'snapcon_logo.png'),
|
||||||
default_color: '#0B3559'
|
default_color: (ENV['DEFAULT_COLOR'] || '#0B3559')
|
||||||
}
|
}
|
||||||
|
|
||||||
config.mailbot = {
|
config.mailbot = {
|
||||||
bcc_address: 'messages@snap.berkeley.edu',
|
ytlf_ticket_id: (ENV['YTLF_TICKET_ID'] || 50)
|
||||||
email_template: 'email_template',
|
|
||||||
ytlf_ticket_id: 50
|
|
||||||
}
|
}
|
||||||
|
|
||||||
config.before_configuration do
|
config.before_configuration do
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,11 @@ Osem::Application.configure do
|
||||||
# Set the secret key base if it's not set via other means
|
# Set the secret key base if it's not set via other means
|
||||||
config.secret_key_base ||= 'f4be765bc98e516de82ac01daa8f8aa11c5ca13cb6c911887851ac89457b6c0b056b2361a21b5c08926c9386e0f91eef84fc0b103d522bf00bc0c78ea8ce7c58'
|
config.secret_key_base ||= 'f4be765bc98e516de82ac01daa8f8aa11c5ca13cb6c911887851ac89457b6c0b056b2361a21b5c08926c9386e0f91eef84fc0b103d522bf00bc0c78ea8ce7c58'
|
||||||
|
|
||||||
|
# Test email address
|
||||||
|
config.mailbot = {
|
||||||
|
bcc_address: 'test@test.com'
|
||||||
|
}
|
||||||
|
|
||||||
# Use omniauth mock credentials
|
# Use omniauth mock credentials
|
||||||
OmniAuth.config.test_mode = true
|
OmniAuth.config.test_mode = true
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -101,4 +101,9 @@ Osem::Application.configure do
|
||||||
|
|
||||||
# Set the secret_key_base from the env, if not set by any other means
|
# Set the secret_key_base from the env, if not set by any other means
|
||||||
config.secret_key_base ||= ENV["SECRET_KEY_BASE"]
|
config.secret_key_base ||= ENV["SECRET_KEY_BASE"]
|
||||||
|
|
||||||
|
# Set bcc email address
|
||||||
|
config.mailbot = {
|
||||||
|
bcc_address: ENV['OSEM_MESSAGE_BCC_ADDRESS']
|
||||||
|
}
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -53,4 +53,9 @@ Osem::Application.configure do
|
||||||
end
|
end
|
||||||
|
|
||||||
config.assets.precompile += ['mailbot.css']
|
config.assets.precompile += ['mailbot.css']
|
||||||
|
|
||||||
|
# Test email address
|
||||||
|
config.mailbot = {
|
||||||
|
bcc_address: 'test@test.com'
|
||||||
|
}
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue