修复 Docker 构建 + 端口可配置
- Dockerfile 设置 GOPROXY=https://goproxy.cn,direct 解决国内网络问题 - 新增 addr 配置项,支持自定义端口,默认 :8080 - docker-compose 端口改为 ${OPS_MCP_PORT:-9090} - 移除 EXPOSE 指令(端口通过 compose 管理) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
+2
-1
@@ -8,6 +8,7 @@ import (
|
||||
|
||||
type Config struct {
|
||||
Transport string `mapstructure:"transport"` // stdio | sse
|
||||
Addr string `mapstructure:"addr"` // 监听地址,默认 :8080
|
||||
}
|
||||
|
||||
func Load() (*Config, error) {
|
||||
@@ -20,8 +21,8 @@ func Load() (*Config, error) {
|
||||
v.SetEnvPrefix("OPS_MCP")
|
||||
v.AutomaticEnv()
|
||||
v.SetDefault("transport", "stdio")
|
||||
v.SetDefault("addr", ":8080")
|
||||
|
||||
// 配置文件不存在不算错误,直接用默认值 + 环境变量
|
||||
if err := v.ReadInConfig(); err != nil {
|
||||
slog.Warn("no config file found, using defaults and env vars", "err", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user