[refactor]Move constants to configuration file

This commit is contained in:
Jimmy 2021-04-12 14:01:49 +08:00
parent 346f324bef
commit b7fbba162b
4 changed files with 18 additions and 6 deletions

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true
EVENTS_PER_PAGE = 3
EVENTS_PER_PAGE = Rails.configuration.conference[:events_per_page]
class ConferencesController < ApplicationController
include ConferenceHelper

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
DEFAULT_LOGO = 'snapcon_logo.png'
DEFAULT_COLOR = '#0B3559'
DEFAULT_LOGO = Rails.configuration.conference[:default_logo]
DEFAULT_COLOR = Rails.configuration.conference[:default_color]
module ConferenceHelper
# Return true if only call_for_papers or call_for_tracks or call_for_booths is open

View file

@ -1,8 +1,8 @@
# frozen_string_literal: true
SNAPCON_BCC_ADDRESS = 'messages@snap.berkeley.edu'
EMAIL_TEMPLATE = 'email_template'
YTLF_TICKET_ID = 50
SNAPCON_BCC_ADDRESS = Rails.configuration.mailbot[:bcc_address]
EMAIL_TEMPLATE = Rails.configuration.mailbot[:email_template]
YTLF_TICKET_ID = Rails.configuration.mailbot[:ytlf_ticket_id]
class Mailbot < ActionMailer::Base
helper ConferenceHelper

View file

@ -66,6 +66,18 @@ module Osem
config.active_job.queue_adapter = :delayed_job
config.conference = {
events_per_page: 3,
default_logo: 'snapcon_logo.png',
default_color: '#0B3559'
}
config.mailbot = {
bcc_address: 'messages@snap.berkeley.edu',
email_template: 'email_template',
ytlf_ticket_id: 50
}
config.before_configuration do
env_file = File.join(Rails.root, 'config', 'local_env.yml')
if File.exist?(env_file)