ffc3adf907
* When before_filter select_foodcoop is activated, the database and configs will be loaded on each request. * Replaced APP_CONFIG with new Foodsoft.config method.
31 lines
No EOL
852 B
Ruby
31 lines
No EOL
852 B
Ruby
# Loads and returns config and databases for selected foodcoop.
|
|
module Foodsoft
|
|
@@configs = YAML.load(File.read(RAILS_ROOT + "/config/app_config.yml"))
|
|
@@databases = YAML.load(File.read(RAILS_ROOT + "/config/database.yml"))
|
|
@@env = RAILS_ENV
|
|
|
|
def env=(env)
|
|
@@env = env
|
|
end
|
|
|
|
def env
|
|
@@env
|
|
end
|
|
|
|
def config(rails_env = @@env)
|
|
@@configs[rails_env].symbolize_keys
|
|
end
|
|
|
|
def database(rails_env = @@env)
|
|
@@databases[rails_env].symbolize_keys
|
|
end
|
|
|
|
extend self
|
|
end
|
|
|
|
|
|
# Configuration of the exception_notification plugin
|
|
# Mailadresses are set in config/foodsoft.yaml
|
|
ExceptionNotifier.exception_recipients = Foodsoft.config[:notification]['error_recipients']
|
|
ExceptionNotifier.sender_address = Foodsoft.config[:notification]['sender_address']
|
|
ExceptionNotifier.email_prefix = Foodsoft.config[:notification]['email_prefix'] |