This commit is contained in:
ziming 2025-03-26 16:39:04 +08:00
parent 10852fac3b
commit fa4449deb0
1 changed files with 3 additions and 1 deletions

View File

@ -14,6 +14,7 @@ import (
"github.com/go-kratos/kratos/v2/transport/http/pprof" "github.com/go-kratos/kratos/v2/transport/http/pprof"
"github.com/gorilla/handlers" "github.com/gorilla/handlers"
http2 "net/http" http2 "net/http"
"time"
v1 "voucher/api/v1" v1 "voucher/api/v1"
"voucher/internal/conf" "voucher/internal/conf"
log2 "voucher/internal/pkg/log" log2 "voucher/internal/pkg/log"
@ -50,8 +51,9 @@ func buildHTTPServer(c *conf.Bootstrap, accessLogger *log2.AccessLogger, log *lo
if c.Server.Http.Addr != "" { if c.Server.Http.Addr != "" {
opts = append(opts, http.Address(c.Server.Http.Addr)) opts = append(opts, http.Address(c.Server.Http.Addr))
} }
if c.Server.Http.Timeout != nil { if c.Server.Http.Timeout != nil {
opts = append(opts, http.Timeout(c.Server.Http.Timeout.AsDuration())) opts = append(opts, http.Timeout(30*time.Second))
} }
// 允许跨域 // 允许跨域