1
0
مراية لـ https://github.com/postalserver/postal.git تم المزامنة 2025-11-30 21:32:30 +00:00

feat(config): support for loading a postal.local.yml config file from the config root if it exists

هذا الالتزام موجود في:
Adam Cooke
2021-07-29 11:16:44 +00:00
الأصل 189dfa509b
التزام 8e3294ba1a
2 ملفات معدلة مع 11 إضافات و1 حذوفات

1
.gitignore مباع
عرض الملف

@@ -25,6 +25,7 @@ config/fast_server.cert
config/fast_server.key
config/postal/**/*
spec/config/postal.local.yml
public/assets
vendor/bundle

عرض الملف

@@ -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