Exit on permission denied
This commit is contained in:
parent
f37349fff7
commit
cffa74f9cf
3 changed files with 24 additions and 4 deletions
1
Makefile
1
Makefile
|
@ -54,5 +54,6 @@ dist:
|
||||||
mkdir dist
|
mkdir dist
|
||||||
|
|
||||||
run-dev:
|
run-dev:
|
||||||
|
go generate
|
||||||
go build
|
go build
|
||||||
./traefik
|
./traefik
|
||||||
|
|
17
traefik.go
17
traefik.go
|
@ -21,6 +21,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
fmtlog "log"
|
fmtlog "log"
|
||||||
"github.com/mailgun/oxy/cbreaker"
|
"github.com/mailgun/oxy/cbreaker"
|
||||||
|
"net"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -168,9 +169,21 @@ func main() {
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
if len(gloablConfiguration.CertFile) > 0 && len(gloablConfiguration.KeyFile) > 0 {
|
if len(gloablConfiguration.CertFile) > 0 && len(gloablConfiguration.KeyFile) > 0 {
|
||||||
srv.ListenAndServeTLS(gloablConfiguration.CertFile, gloablConfiguration.KeyFile)
|
err := srv.ListenAndServeTLS(gloablConfiguration.CertFile, gloablConfiguration.KeyFile)
|
||||||
|
if (err!= nil ){
|
||||||
|
netOpError, ok := err.(*net.OpError)
|
||||||
|
if ok && netOpError.Err.Error() != "use of closed network connection" {
|
||||||
|
log.Fatal("Error creating server: ", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
srv.ListenAndServe()
|
err := srv.ListenAndServe()
|
||||||
|
if (err!= nil ){
|
||||||
|
netOpError, ok := err.(*net.OpError)
|
||||||
|
if ok && netOpError.Err.Error() != "use of closed network connection" {
|
||||||
|
log.Fatal("Error creating server: ", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
log.Notice("Started")
|
log.Notice("Started")
|
||||||
|
|
10
web.go
10
web.go
|
@ -46,9 +46,15 @@ func (provider *WebProvider) Provide(configurationChan chan<- *Configuration) {
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
if len(provider.CertFile) > 0 && len(provider.KeyFile) > 0 {
|
if len(provider.CertFile) > 0 && len(provider.KeyFile) > 0 {
|
||||||
http.ListenAndServeTLS(provider.Address,provider.CertFile, provider.KeyFile, systemRouter)
|
err := http.ListenAndServeTLS(provider.Address,provider.CertFile, provider.KeyFile, systemRouter)
|
||||||
|
if (err!= nil ){
|
||||||
|
log.Fatal("Error creating server: ", err)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
http.ListenAndServe(provider.Address, systemRouter)
|
err := http.ListenAndServe(provider.Address, systemRouter)
|
||||||
|
if (err!= nil ){
|
||||||
|
log.Fatal("Error creating server: ", err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue