diff --git a/app/views/domains/_nav.html.haml b/app/views/domains/_nav.html.haml
index 7e9bed9..1fb3076 100644
--- a/app/views/domains/_nav.html.haml
+++ b/app/views/domains/_nav.html.haml
@@ -1,5 +1,5 @@
.navBar.navBar--secondary
%ul
%li.navBar__item= link_to "Domains", organization_server_domains_path(organization, @server), :class => ['navBar__link', active_nav == :domains ? 'is-active' : '']
- - if Postal.fast_server?
+ - if Postal.tracking_available?
%li.navBar__item= link_to "Tracking Domains", organization_server_track_domains_path(organization, @server), :class => ['navBar__link', active_nav == :track_domains ? 'is-active' : '']
diff --git a/config/postal.defaults.yml b/config/postal.defaults.yml
new file mode 100644
index 0000000..1a09f7f
--- /dev/null
+++ b/config/postal.defaults.yml
@@ -0,0 +1,85 @@
+# These are the default configuration options that will be used if they aren't overriden
+# in your postal.yml configuration file. No changes should be made to this file for
+# your installation.
+
+# You can refer to this for a complete listing all available configuration options.
+
+web:
+ host: postal.example.com
+ protocol: https
+
+general:
+ use_ip_pools: false
+ exception_url:
+
+web_server:
+ bind_address: 127.0.0.1
+ port: 5000
+ max_threads: 5
+
+fast_server:
+ enabled: false
+ bind_address: 0.0.0.0
+ port: 5010
+ ssl_port: 5011
+ proxy_protocol: false
+
+main_db:
+ host: 127.0.0.1
+ port: 3306
+ username: postal
+ password:
+ database: postal
+
+logging:
+ stdout: false
+ max_log_file_size: 20
+ max_log_files: 10
+
+message_db:
+ host: 127.0.0.1
+ port: 3306
+ username: postal
+ password:
+ prefix: postal
+
+rabbitmq:
+ host: 127.0.0.1
+ port: 5672
+ username: postal
+ password:
+ vhost: /postal
+
+workers:
+ quantity: 1
+
+smtp_server:
+ proxy_protocol: false
+ log_connect: true
+ evented: true
+ ports:
+ - 2525
+
+dns:
+ mx_records:
+ - mx.postal.example.com
+ smtp_server_hostname: postal.example.com
+ spf_include: spf.postal.example.com
+ return_path: rp.postal.example.com
+ route_domain: routes.postal.example.com
+ track_domain: track.postal.example.com
+ dkim_identifier: postal
+ domain_verify_prefix: postal-verification
+ custom_return_path_prefix: psrp
+
+smtp:
+ host: 127.0.0.1
+ port: 2525
+ username: # Complete when Postal is running and you can
+ password: # generate the credentials within the interface.
+ from_name: Postal
+ from_address: postal@yourdomain.com
+
+rails:
+ environment: production
+ secret_key:
diff --git a/config/postal.example.yml b/config/postal.example.yml
index 8c9ba55..393b2a8 100644
--- a/config/postal.example.yml
+++ b/config/postal.example.yml
@@ -1,59 +1,45 @@
web:
+ # The host that the management interface will be available on
host: postal.example.com
+ # The protocol that requests to the management interface should happen on
protocol: https
-web_server:
- bind_address: 127.0.0.1
- port: 5000
- max_threads: 5
-
fast_server:
- bind_address: 0.0.0.0
- port: 5010
- ssl_port: 5011
- proxy_protocol: false
+ # This can be enabled to enable click & open tracking on emails. It is disabled by
+ # default as it requires a separate static IP address on your server.
+ enabled: false
general:
+ # This can be changed to allow messages to be sent from multiple IP addresses
use_ip_pools: false
- exception_url: null
-workers:
- quantity: 1
-
-logging:
- stdout: false
- max_log_file_size: 20
- max_log_files: 10
main_db:
+ # Specify the connection details for your MySQL database
host: 127.0.0.1
- port: 3306
username: postal
password:
database: postal
message_db:
+ # Specify the connection details for your MySQL server that will be house the
+ # message databases for mail servers.
host: 127.0.0.1
- port: 3306
username: postal
password:
prefix: postal
rabbitmq:
+ # Specify the connection details for your RabbitMQ server.
host: 127.0.0.1
- port: 5672
username: postal
- password: xxx
+ password:
vhost: /postal
-smtp_server:
- proxy_protocol: false
- log_connect: true
- evented: true
- ports:
- - 2525
-
dns:
+ # Specifies the DNS record that you have configured. Refer to the documentation at
+ # https://github.com/atech/postal/wiki/Domains-&-DNS-Configuration for further
+ # information about these.
mx_records:
- mx.postal.example.com
smtp_server_hostname: postal.example.com
@@ -61,11 +47,11 @@ dns:
return_path: rp.postal.example.com
route_domain: routes.postal.example.com
track_domain: track.postal.example.com
- dkim_identifier: postal
- domain_verify_prefix: postal-verification
- custom_return_path_prefix: psrp
smtp:
+ # Specify an SMTP server that can be used to send messages from the Postal management
+ # system to users. You can configure this to use a Postal mail server once the
+ # your installation has been set up.
host: 127.0.0.1
port: 2525
username: # Complete when Postal is running and you can
@@ -74,6 +60,6 @@ smtp:
from_address: postal@yourdomain.com
rails:
- environment: production
+ # This is generated automatically by the config initialization. It should be a random
+ # string unique to your installation.
secret_key: {{secretkey}}
-
diff --git a/lib/postal/config.rb b/lib/postal/config.rb
index 59d2558..ecf2dd9 100644
--- a/lib/postal/config.rb
+++ b/lib/postal/config.rb
@@ -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
diff --git a/lib/postal/message_db/message.rb b/lib/postal/message_db/message.rb
index 82c1340..628d613 100644
--- a/lib/postal/message_db/message.rb
+++ b/lib/postal/message_db/message.rb
@@ -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
diff --git a/lib/postal/message_parser.rb b/lib/postal/message_parser.rb
index b38276e..5f668c8 100644
--- a/lib/postal/message_parser.rb
+++ b/lib/postal/message_parser.rb
@@ -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
diff --git a/script/update_process_concurrency.rb b/script/update_process_concurrency.rb
index a5de27d..4945ec9 100755
--- a/script/update_process_concurrency.rb
+++ b/script/update_process_concurrency.rb
@@ -8,7 +8,7 @@ hash = {
'quantity' => worker_quantity
},
'fast' => {
- 'quantity' => Postal.config.fast_server ? 1 : 0
+ 'quantity' => Postal.config.fast_server.enabled? ? 1 : 0
}
}
}.to_yaml