class Schleuder::Conf
Constants
- DEFAULTS
- EMAIL_REGEXP
- FINGERPRINT_REGEXP
TODO: drop v3 keys and only accept length of 40
Public Class Methods
api()
click to toggle source
# File lib/schleuder/conf.rb, line 95 def self.api instance.config['api'] || {} end
api_valid_api_keys()
click to toggle source
# File lib/schleuder/conf.rb, line 99 def self.api_valid_api_keys Array(api['valid_api_keys']) end
database()
click to toggle source
# File lib/schleuder/conf.rb, line 79 def self.database instance.config['database'][ENV['SCHLEUDER_ENV']] end
databases()
click to toggle source
# File lib/schleuder/conf.rb, line 83 def self.databases instance.config['database'] end
filters_dir()
click to toggle source
# File lib/schleuder/conf.rb, line 75 def self.filters_dir instance.config['filters_dir'] end
http_proxy()
click to toggle source
# File lib/schleuder/conf.rb, line 138 def self.http_proxy instance.config['http_proxy'] end
keyword_handlers_dir()
click to toggle source
# File lib/schleuder/conf.rb, line 71 def self.keyword_handlers_dir instance.config['keyword_handlers_dir'] end
listlogs_dir()
click to toggle source
# File lib/schleuder/conf.rb, line 67 def self.listlogs_dir instance.config['listlogs_dir'] end
lists_dir()
click to toggle source
# File lib/schleuder/conf.rb, line 59 def self.lists_dir instance.config['lists_dir'] end
log_level()
click to toggle source
# File lib/schleuder/conf.rb, line 91 def self.log_level instance.config['log_level'] || 'WARN' end
sks_keyserver()
click to toggle source
# File lib/schleuder/conf.rb, line 134 def self.sks_keyserver instance.config['sks_keyserver'] end
smtp_helo_domain()
click to toggle source
# File lib/schleuder/conf.rb, line 112 def self.smtp_helo_domain instance.config['smtp_helo_domain'] end
smtp_host()
click to toggle source
Three legacy options
# File lib/schleuder/conf.rb, line 104 def self.smtp_host instance.config['smtp_host'] end
smtp_port()
click to toggle source
# File lib/schleuder/conf.rb, line 108 def self.smtp_port instance.config['smtp_port'] end
smtp_settings()
click to toggle source
# File lib/schleuder/conf.rb, line 116 def self.smtp_settings settings = instance.config['smtp_settings'] || {} # Support previously used config-options. # Remove this in future versions. {smtp_host: :address, smtp_port: :port, smtp_helo_domain: :domain}.each do |old, new| value = self.send(old) if value.present? Schleuder.logger.warn "Deprecation warning: In schleuder.yml #{old} should be changed to smtp_settings[#{new}]." settings[new] = value end end settings end
superadmin()
click to toggle source
# File lib/schleuder/conf.rb, line 87 def self.superadmin instance.config['superadmin'] end
umask()
click to toggle source
# File lib/schleuder/conf.rb, line 63 def self.umask instance.config['umask'] end
vks_keyserver()
click to toggle source
# File lib/schleuder/conf.rb, line 130 def self.vks_keyserver instance.config['vks_keyserver'] end
Public Instance Methods
config()
click to toggle source
# File lib/schleuder/conf.rb, line 50 def config @config ||= load_config(ENV['SCHLEUDER_CONFIG']) end
reload!()
click to toggle source
# File lib/schleuder/conf.rb, line 54 def reload! @config = nil config end
Private Instance Methods
load_config(filename)
click to toggle source
# File lib/schleuder/conf.rb, line 144 def load_config(filename) DEFAULTS.deep_merge(load_config_file(filename)) end
load_config_file(filename)
click to toggle source
# File lib/schleuder/conf.rb, line 148 def load_config_file(filename) file = Pathname.new(filename) if file.readable? YAML.load(ERB.new(file.read).result) else {} end end