Allow ERB syntax in the app_config.yml

This change allows us to refer to envrionment variables in the yml file.
This is helpful if passwords are passed as environment variables in
Docker installations to avoid plain passwords in configuration files.
This commit is contained in:
Patrick Gansterer 2017-03-04 12:08:15 +01:00 committed by wvengen
parent e5cec637fc
commit 04a833a5f5
1 changed files with 1 additions and 1 deletions

View File

@ -60,7 +60,7 @@ class FoodsoftConfig
# @param filename [String] Override configuration file # @param filename [String] Override configuration file
def init(filename = APP_CONFIG_FILE) def init(filename = APP_CONFIG_FILE)
Rails.logger.info "Loading app configuration from #{APP_CONFIG_FILE}" Rails.logger.info "Loading app configuration from #{APP_CONFIG_FILE}"
APP_CONFIG.clear.merge! YAML.load(File.read(File.expand_path(filename, Rails.root))) APP_CONFIG.clear.merge! YAML.load(ERB.new(File.read(File.expand_path(filename, Rails.root))).result)
# Gather program-default configuration # Gather program-default configuration
self.default_config = get_default_config self.default_config = get_default_config
# Load initial config from development or production # Load initial config from development or production