modernize + gofumpt
This commit is contained in:
12
ekko/ekko.go
12
ekko/ekko.go
@@ -16,6 +16,7 @@ import (
|
||||
"go.opentelemetry.io/contrib/instrumentation/github.com/labstack/echo/otelecho"
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
"go.opentelemetry.io/otel/trace"
|
||||
"golang.org/x/net/http2"
|
||||
"golang.org/x/sync/errgroup"
|
||||
)
|
||||
|
||||
@@ -50,7 +51,8 @@ func (ek *Ekko) Start(ctx context.Context) error {
|
||||
g.Go(func() error {
|
||||
e.Server.Addr = fmt.Sprintf(":%d", ek.port)
|
||||
log.Info("server starting", "port", ek.port)
|
||||
err := e.Server.ListenAndServe()
|
||||
// err := e.Server.ListenAndServe()
|
||||
err := e.StartH2CServer(e.Server.Addr, &http2.Server{})
|
||||
if err == http.ErrServerClosed {
|
||||
return nil
|
||||
}
|
||||
@@ -120,7 +122,13 @@ func (ek *Ekko) setup(ctx context.Context) (*echo.Echo, error) {
|
||||
e.Use(middleware.Gzip())
|
||||
}
|
||||
|
||||
e.Use(middleware.Secure())
|
||||
secureConfig := middleware.DefaultSecureConfig
|
||||
// secureConfig.ContentSecurityPolicy = "default-src *"
|
||||
secureConfig.ContentSecurityPolicy = ""
|
||||
secureConfig.HSTSMaxAge = int(time.Hour * 168 * 30 / time.Second)
|
||||
secureConfig.HSTSPreloadEnabled = true
|
||||
|
||||
e.Use(middleware.SecureWithConfig(secureConfig))
|
||||
|
||||
e.Use(
|
||||
func(next echo.HandlerFunc) echo.HandlerFunc {
|
||||
|
Reference in New Issue
Block a user