مراية لـ
https://github.com/postalserver/postal.git
تم المزامنة 2025-11-30 21:32:30 +00:00
add a defaults file containing all defaults for configuration options and tidy initial config
هذا الالتزام موجود في:
@@ -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
|
||||
|
||||
@@ -545,7 +545,7 @@ module Postal
|
||||
# Should this message be parsed?
|
||||
#
|
||||
def should_parse?
|
||||
parsed? == false && headers['x-amp'] != 'skip' && Postal.fast_server?
|
||||
parsed? == false && headers['x-amp'] != 'skip'
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@@ -80,11 +80,11 @@ module Postal
|
||||
end
|
||||
|
||||
def parse(part, type = nil)
|
||||
if @domain.track_clicks?
|
||||
if Postal.tracking_available? && @domain.track_clicks?
|
||||
part = insert_links(part, type)
|
||||
end
|
||||
|
||||
if @domain.track_loads? && type == :html
|
||||
if Postal.tracking_available? && @domain.track_loads? && type == :html
|
||||
part = insert_tracking_image(part)
|
||||
end
|
||||
|
||||
|
||||
المرجع في مشكلة جديدة
حظر مستخدم