git » chasquid » commit 498bb29

config: Set defaults for suffix_separators and drop_characters

author Alberto Bertogli
2016-10-03 00:40:56 UTC
committer Alberto Bertogli
2016-10-09 23:51:05 UTC
parent 55b03c8cf083b410143a573c1ca23e92a33af055

config: Set defaults for suffix_separators and drop_characters

This patch sets common and practical defaults for the suffix_separators ("+")
and drop_character options (".").

internal/config/config.go +8 -0
internal/config/config.proto +4 -2

diff --git a/internal/config/config.go b/internal/config/config.go
index e815d03..dfa8a79 100644
--- a/internal/config/config.go
+++ b/internal/config/config.go
@@ -62,6 +62,14 @@ func Load(path string) (*Config, error) {
 		c.DataDir = "/var/lib/chasquid"
 	}
 
+	if c.SuffixSeparators == "" {
+		c.SuffixSeparators = "+"
+	}
+
+	if c.DropCharacters == "" {
+		c.DropCharacters = "."
+	}
+
 	return c, nil
 }
 
diff --git a/internal/config/config.proto b/internal/config/config.proto
index b57e335..601302a 100644
--- a/internal/config/config.proto
+++ b/internal/config/config.proto
@@ -49,13 +49,15 @@ message Config {
 	// Suffix separator, to perform suffix removal of local users.
 	// For example, if you set this to "-+", email to local user
 	// "user-blah" and "user+blah" will be delivered to "user".
-	// Default: none.
+	// Including "+" is strongly encouraged, as it is assumed for email
+	// forwarding.
+	// Default: "+".
 	string suffix_separators = 9;
 
 	// Characters to drop from the user part on local emails.
 	// For example, if you set this to "._", email to local user
 	// "u.se_r" will be delivered to "user".
-	// Default: none.
+	// Default: ".".
 	string drop_characters = 10;
 }