1
0
mirror of https://github.com/containous/traefik.git synced 2024-12-22 13:34:03 +03:00

Exit on permission denied

This commit is contained in:
emile 2015-09-24 11:39:18 +02:00
parent f37349fff7
commit cffa74f9cf
3 changed files with 24 additions and 4 deletions

View File

@ -54,5 +54,6 @@ dist:
mkdir dist
run-dev:
go generate
go build
./traefik

View File

@ -21,6 +21,7 @@ import (
"time"
fmtlog "log"
"github.com/mailgun/oxy/cbreaker"
"net"
)
var (
@ -168,9 +169,21 @@ func main() {
go func() {
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 {
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")

10
web.go
View File

@ -46,9 +46,15 @@ func (provider *WebProvider) Provide(configurationChan chan<- *Configuration) {
go func() {
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 {
http.ListenAndServe(provider.Address, systemRouter)
err := http.ListenAndServe(provider.Address, systemRouter)
if (err!= nil ){
log.Fatal("Error creating server: ", err)
}
}
}()
}