mirror of
https://github.com/wiggin77/mailrelay.git
synced 2024-11-25 08:33:09 +01:00
added AllowedHosts configuration
This commit is contained in:
parent
567755e257
commit
fd213dd450
@ -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": ["*"]
|
||||||
}
|
}
|
||||||
|
13
main.go
13
main.go
@ -15,12 +15,13 @@ type loggerLevels struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type mailRelayConfig struct {
|
type mailRelayConfig struct {
|
||||||
SMTPServer string `json:"smtp_server"`
|
SMTPServer string `json:"smtp_server"`
|
||||||
SMTPPort int `json:"smtp_port"`
|
SMTPPort int `json:"smtp_port"`
|
||||||
SMTPUsername string `json:"smtp_username"`
|
SMTPUsername string `json:"smtp_username"`
|
||||||
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,
|
||||||
|
Loading…
Reference in New Issue
Block a user