1
0
مراية لـ https://github.com/postalserver/postal.git تم المزامنة 2026-03-03 14:24:06 +00:00

add a defaults file containing all defaults for configuration options and tidy initial config

هذا الالتزام موجود في:
Adam Cooke
2017-04-27 09:35:57 +01:00
الأصل c36b3f6f51
التزام 1f64c61105
7 ملفات معدلة مع 123 إضافات و43 حذوفات

عرض الملف

@@ -26,7 +26,8 @@ module Postal
def self.config
@config ||= begin
require 'hashie/mash'
Hashie::Mash.new(yaml_config)
config = Hashie::Mash.new(self.defaults)
config.deep_merge(self.yaml_config)
end
end
@@ -50,6 +51,14 @@ module Postal
@yaml_config ||= File.exist?(config_file_path) ? YAML.load_file(config_file_path) : {}
end
def self.defaults_file_path
@defaults_file_path ||= app_root.join('config', 'postal.defaults.yml')
end
def self.defaults
@defaults ||= YAML.load_file(self.defaults_file_path)
end
def self.database_url
if config.main_db
"mysql2://#{CGI.escape(config.main_db.username.to_s)}:#{CGI.escape(config.main_db.password.to_s)}@#{config.main_db.host}:#{config.main_db.port}/#{config.main_db.database}?reconnect=true&encoding=#{config.main_db.encoding || 'utf8mb4'}"
@@ -161,12 +170,12 @@ module Postal
end
end
def self.anonymous_signup?
config.general&.anonymous_signup != false
def self.tracking_available?
self.config.fast_server.enabled?
end
def self.fast_server?
!!self.config.fast_server
def self.ip_pools?
self.config.general.use_ip_pools?
end
end