mirror of
https://github.com/wiggin77/mailrelay.git
synced 2025-08-18 02:49:52 +02:00
Merge pull request #2 from Progymedia/allowed-hosts
added AllowedHosts configuration
This commit is contained in:
@@ -25,7 +25,8 @@ On local PC (192.168.1.54) create file `/etc/mailrelay.json` with contents:
|
|||||||
"smtp_username": "username@fastmail.com",
|
"smtp_username": "username@fastmail.com",
|
||||||
"smtp_password": "secretAppPassword",
|
"smtp_password": "secretAppPassword",
|
||||||
"local_listen_ip": "0.0.0.0",
|
"local_listen_ip": "0.0.0.0",
|
||||||
"local_listen_port": 2525
|
"local_listen_port": 2525,
|
||||||
|
"allowed_hosts": ["*"]
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@@ -5,4 +5,5 @@
|
|||||||
"smtp_password": "secret_app_password",
|
"smtp_password": "secret_app_password",
|
||||||
"local_listen_port": 2525,
|
"local_listen_port": 2525,
|
||||||
"local_listen_ip": "0.0.0.0"
|
"local_listen_ip": "0.0.0.0"
|
||||||
|
"allowed_hosts": ["*"]
|
||||||
}
|
}
|
||||||
|
1
main.go
1
main.go
@@ -21,6 +21,7 @@ type mailRelayConfig struct {
|
|||||||
SMTPPassword string `json:"smtp_password"`
|
SMTPPassword string `json:"smtp_password"`
|
||||||
LocalListenIP string `json:"local_listen_ip"`
|
LocalListenIP string `json:"local_listen_ip"`
|
||||||
LocalListenPort int `json:"local_listen_port"`
|
LocalListenPort int `json:"local_listen_port"`
|
||||||
|
AllowedHosts []string `json:"allowed_hosts"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Logger provides application logging.
|
// Logger provides application logging.
|
||||||
|
@@ -14,7 +14,7 @@ func Start(appConfig *mailRelayConfig) (err error) {
|
|||||||
|
|
||||||
listen := fmt.Sprintf("%s:%d", appConfig.LocalListenIP, appConfig.LocalListenPort)
|
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{
|
sc := guerrilla.ServerConfig{
|
||||||
ListenInterface: listen,
|
ListenInterface: listen,
|
||||||
IsEnabled: true,
|
IsEnabled: true,
|
||||||
|
Reference in New Issue
Block a user