Skip to content

Commit b5dbc44

Browse files
committed
feat(server/config): 添加配置项
1 parent 4601d86 commit b5dbc44

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

server/config/http.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@ type (
3030
// 格式与 [http.Server.Addr] 相同。可以为空,表示由 [http.Server] 确定其默认值。
3131
Port string `yaml:"port,omitempty" json:"port,omitempty" xml:"port,attr,omitempty"`
3232

33+
// [web.Router.URL] 的默认前缀
34+
//
35+
// 如果是非标准端口,应该带上端口号。
36+
//
37+
// NOTE: 每个路由可使用 [web.WithURLDomain] 重新定义该值。
38+
URL string `yaml:"url,omitempty" json:"url,omitempty" xml:"url,omitempty"`
39+
3340
// x-request-id 的报头名称
3441
//
3542
// 如果为空,则采用 [header.XRequestID] 作为默认值。
@@ -262,6 +269,10 @@ func (h *httpConfig) buildInit(l *logs.Logs) {
262269
if h.trace != nil {
263270
o.RoutersOptions = append(o.RoutersOptions, h.trace)
264271
}
272+
273+
if h.URL != "" {
274+
o.RoutersOptions = append(o.RoutersOptions, web.WithURLDomain(h.URL))
275+
}
265276
}
266277
}
267278

web.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424
)
2525

2626
// Version 当前框架的版本
27-
const Version = "0.100.0"
27+
const Version = "0.100.1"
2828

2929
type (
3030
Logger = logs.Logger

0 commit comments

Comments
 (0)