1
0
mirror of https://github.com/labstack/echo.git synced 2025-01-12 01:22:21 +02:00

Log message for starting server

Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
Vishal Rana 2016-09-24 20:50:35 -07:00
parent d069d9b3a9
commit fc8c033f3c

View File

@ -63,7 +63,6 @@ type (
Echo struct { Echo struct {
Server *http.Server Server *http.Server
TLSServer *http.Server TLSServer *http.Server
TLSConfig *tls.Config
ShutdownTimeout time.Duration ShutdownTimeout time.Duration
DisableHTTP2 bool DisableHTTP2 bool
Debug bool Debug bool
@ -514,6 +513,7 @@ func (e *Echo) ServeHTTP(w http.ResponseWriter, r *http.Request) {
func (e *Echo) Start(address string) (err error) { func (e *Echo) Start(address string) (err error) {
e.graceful.Server = e.Server e.graceful.Server = e.Server
e.graceful.Addr = address e.graceful.Addr = address
e.Logger.Printf(" ⇛ http server started on %s", e.Logger.Color().Green(address))
return e.graceful.ListenAndServe() return e.graceful.ListenAndServe()
} }
@ -527,9 +527,9 @@ func (e *Echo) StartTLS(address string, certFile, keyFile string) (err error) {
return errors.New("invalid tls configuration") return errors.New("invalid tls configuration")
} }
config := &tls.Config{} config := &tls.Config{}
if e.TLSConfig != nil { if e.TLSServer.TLSConfig != nil {
// TODO: https://github.com/golang/go/commit/d24f446a90ea94b87591bf16228d7d871fec3d92 // TODO: https://github.com/golang/go/commit/d24f446a90ea94b87591bf16228d7d871fec3d92
*config = *e.TLSConfig *config = *e.TLSServer.TLSConfig
} }
if !e.DisableHTTP2 { if !e.DisableHTTP2 {
config.NextProtos = append(config.NextProtos, "h2") config.NextProtos = append(config.NextProtos, "h2")
@ -539,6 +539,7 @@ func (e *Echo) StartTLS(address string, certFile, keyFile string) (err error) {
if err != nil { if err != nil {
return return
} }
e.Logger.Printf(" ⇛ https server started on %s", e.Logger.Color().Green(address))
return e.gracefulTLS.ListenAndServeTLSConfig(config) return e.gracefulTLS.ListenAndServeTLSConfig(config)
} }