diff --git a/.gitignore b/.gitignore index ccbb4c8..7ac6cff 100644 --- a/.gitignore +++ b/.gitignore @@ -25,6 +25,7 @@ config/fast_server.cert config/fast_server.key config/postal/**/* +spec/config/postal.local.yml public/assets vendor/bundle diff --git a/lib/postal/config.rb b/lib/postal/config.rb index acda5c8..335374b 100644 --- a/lib/postal/config.rb +++ b/lib/postal/config.rb @@ -28,7 +28,8 @@ module Postal @config ||= begin require 'hashie/mash' config = Hashie::Mash.new(self.defaults) - config.deep_merge(self.yaml_config) + config = config.deep_merge(self.yaml_config) + config.deep_merge(self.local_yaml_config) end end @@ -64,6 +65,14 @@ module Postal @yaml_config ||= File.exist?(config_file_path) ? YAML.load_file(config_file_path) : {} end + def self.local_config_file_path + @local_config_file_path ||= File.join(config_root, 'postal.local.yml') + end + + def self.local_yaml_config + @local_yaml_config ||= File.exist?(local_config_file_path) ? YAML.load_file(local_config_file_path) : {} + end + def self.defaults_file_path @defaults_file_path ||= app_root.join('config', 'postal.defaults.yml') end