feat: add middlewares
This commit is contained in:
@@ -9,7 +9,7 @@ const DefaultPrefix = "Http"
|
||||
type Config struct {
|
||||
StaticPath *string
|
||||
StaticRoute *string
|
||||
Host *string
|
||||
BaseURI *string
|
||||
Port uint
|
||||
Tls *Tls
|
||||
Cors *Cors
|
||||
@@ -34,12 +34,5 @@ type Whitelist struct {
|
||||
}
|
||||
|
||||
func (h *Config) Address() string {
|
||||
if h.Host == nil {
|
||||
return h.PortString()
|
||||
}
|
||||
return fmt.Sprintf("%s:%d", *h.Host, h.Port)
|
||||
}
|
||||
|
||||
func (h *Config) PortString() string {
|
||||
return fmt.Sprintf(":%d", h.Port)
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@ func (svc *Service) Serve() error {
|
||||
OnShutdownError: func(err error) {
|
||||
log.Error("http server shutdown error: ", err)
|
||||
},
|
||||
|
||||
// DisableStartupMessage: true,
|
||||
}
|
||||
|
||||
@@ -52,7 +53,7 @@ func (svc *Service) Serve() error {
|
||||
svc.Engine.Shutdown()
|
||||
})
|
||||
|
||||
return svc.Engine.Listen(svc.conf.PortString(), listenConfig)
|
||||
return svc.Engine.Listen(svc.conf.Address(), listenConfig)
|
||||
}
|
||||
|
||||
func Provide(opts ...opt.Option) error {
|
||||
|
||||
Reference in New Issue
Block a user