From 04a833a5f5e8ba923c11fb44aca1e7e8afa8df42 Mon Sep 17 00:00:00 2001 From: Patrick Gansterer Date: Sat, 4 Mar 2017 12:08:15 +0100 Subject: [PATCH] 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. --- lib/foodsoft_config.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/foodsoft_config.rb b/lib/foodsoft_config.rb index 2e75e860..a89784ac 100644 --- a/lib/foodsoft_config.rb +++ b/lib/foodsoft_config.rb @@ -60,7 +60,7 @@ class FoodsoftConfig # @param filename [String] Override configuration file def init(filename = 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 self.default_config = get_default_config # Load initial config from development or production