Merge pull request #2 from Progymedia/allowed-hosts

added AllowedHosts configuration
This commit is contained in:
Doug Lauder 2020-04-09 18:59:50 -04:00 committed by GitHub
commit 7430423aa2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 8 deletions

View File

@ -25,7 +25,8 @@ On local PC (192.168.1.54) create file `/etc/mailrelay.json` with contents:
"smtp_username": "username@fastmail.com",
"smtp_password": "secretAppPassword",
"local_listen_ip": "0.0.0.0",
"local_listen_port": 2525
"local_listen_port": 2525,
"allowed_hosts": ["*"]
}
```

View File

@ -5,4 +5,5 @@
"smtp_password": "secret_app_password",
"local_listen_port": 2525,
"local_listen_ip": "0.0.0.0"
"allowed_hosts": ["*"]
}

View File

@ -21,6 +21,7 @@ type mailRelayConfig struct {
SMTPPassword string `json:"smtp_password"`
LocalListenIP string `json:"local_listen_ip"`
LocalListenPort int `json:"local_listen_port"`
AllowedHosts []string `json:"allowed_hosts"`
}
// Logger provides application logging.

View File

@ -14,7 +14,7 @@ func Start(appConfig *mailRelayConfig) (err error) {
listen := fmt.Sprintf("%s:%d", appConfig.LocalListenIP, appConfig.LocalListenPort)
cfg := &guerrilla.AppConfig{LogFile: log.OutputStdout.String(), AllowedHosts: []string{"warpmail.net"}}
cfg := &guerrilla.AppConfig{LogFile: log.OutputStdout.String(), AllowedHosts: appConfig.AllowedHosts}
sc := guerrilla.ServerConfig{
ListenInterface: listen,
IsEnabled: true,