refactor: 端口调整

This commit is contained in:
tbphp
2025-07-14 14:08:05 +08:00
parent a0b1223818
commit 2fdd963613
7 changed files with 8 additions and 8 deletions

View File

@@ -1,5 +1,5 @@
# 服务器配置 # 服务器配置
PORT=3000 PORT=3001
HOST=0.0.0.0 HOST=0.0.0.0
# 服务器读取、写入和空闲连接的超时时间(秒) # 服务器读取、写入和空闲连接的超时时间(秒)

View File

@@ -32,5 +32,5 @@ RUN apk upgrade --no-cache \
&& update-ca-certificates && update-ca-certificates
COPY --from=builder2 /build/gpt-load . COPY --from=builder2 /build/gpt-load .
EXPOSE 3000 EXPOSE 3001
ENTRYPOINT ["/app/gpt-load"] ENTRYPOINT ["/app/gpt-load"]

View File

@@ -6,7 +6,7 @@ services:
# dockerfile: Dockerfile # dockerfile: Dockerfile
container_name: gpt-load container_name: gpt-load
ports: ports:
- "3000:3000" - "${PORT:-3001}:${PORT:-3001}"
env_file: env_file:
- .env - .env
restart: always restart: always

View File

@@ -70,7 +70,7 @@ func (m *Manager) ReloadConfig() error {
config := &Config{ config := &Config{
Server: types.ServerConfig{ Server: types.ServerConfig{
Port: utils.ParseInteger(os.Getenv("PORT"), 3000), Port: utils.ParseInteger(os.Getenv("PORT"), 3001),
Host: utils.GetEnvOrDefault("HOST", "0.0.0.0"), Host: utils.GetEnvOrDefault("HOST", "0.0.0.0"),
ReadTimeout: utils.ParseInteger(os.Getenv("SERVER_READ_TIMEOUT"), 120), ReadTimeout: utils.ParseInteger(os.Getenv("SERVER_READ_TIMEOUT"), 120),
WriteTimeout: utils.ParseInteger(os.Getenv("SERVER_WRITE_TIMEOUT"), 1800), WriteTimeout: utils.ParseInteger(os.Getenv("SERVER_WRITE_TIMEOUT"), 1800),

View File

@@ -130,7 +130,7 @@ func (sm *SystemSettingsManager) EnsureSettingsInitialized() error {
} }
port := os.Getenv("PORT") port := os.Getenv("PORT")
if port == "" { if port == "" {
port = "3000" port = "3001"
} }
value = fmt.Sprintf("http://%s:%s", host, port) value = fmt.Sprintf("http://%s:%s", host, port)
} }
@@ -172,7 +172,7 @@ func (sm *SystemSettingsManager) GetAppUrl() string {
} }
port := os.Getenv("PORT") port := os.Getenv("PORT")
if port == "" { if port == "" {
port = "3000" port = "3001"
} }
return fmt.Sprintf("http://%s:%s", host, port) return fmt.Sprintf("http://%s:%s", host, port)
} }

View File

@@ -17,7 +17,7 @@ type ConfigManager interface {
// SystemSettings 定义所有系统配置项 // SystemSettings 定义所有系统配置项
type SystemSettings struct { type SystemSettings struct {
// 基础参数 // 基础参数
AppUrl string `json:"app_url" default:"http://localhost:3000" name:"项目地址" category:"基础参数" desc:"项目的基础 URL用于拼接分组终端节点地址。系统配置优先于环境变量 APP_URL。"` AppUrl string `json:"app_url" default:"http://localhost:3001" name:"项目地址" category:"基础参数" desc:"项目的基础 URL用于拼接分组终端节点地址。系统配置优先于环境变量 APP_URL。"`
RequestLogRetentionDays int `json:"request_log_retention_days" default:"7" name:"日志保留时长(天)" category:"基础参数" desc:"请求日志在数据库中的保留天数0为不清理日志。" validate:"min=0"` RequestLogRetentionDays int `json:"request_log_retention_days" default:"7" name:"日志保留时长(天)" category:"基础参数" desc:"请求日志在数据库中的保留天数0为不清理日志。" validate:"min=0"`
RequestLogWriteIntervalMinutes int `json:"request_log_write_interval_minutes" default:"5" name:"日志延迟写入周期(分钟)" category:"基础参数" desc:"请求日志从缓存写入数据库的周期分钟0为实时写入数据。" validate:"min=0"` RequestLogWriteIntervalMinutes int `json:"request_log_write_interval_minutes" default:"5" name:"日志延迟写入周期(分钟)" category:"基础参数" desc:"请求日志从缓存写入数据库的周期分钟0为实时写入数据。" validate:"min=0"`

View File

@@ -21,7 +21,7 @@ export default defineConfig(({ mode }) => {
// 代理配置示例 // 代理配置示例
proxy: { proxy: {
"/api": { "/api": {
target: env.VITE_API_BASE_URL || "http://127.0.0.1:3000", target: env.VITE_API_BASE_URL || "http://127.0.0.1:3001",
changeOrigin: true, changeOrigin: true,
}, },
}, },