新增 Docker Compose 支持,完善环境变量绑定逻辑,升级 Go 版本

This commit is contained in:
2026-01-26 23:45:29 +08:00
parent e2a99b7888
commit 8bacb09cc2
6 changed files with 56 additions and 4 deletions

View File

@@ -3,6 +3,7 @@ package config
import (
"fmt"
"os"
"strings"
"sync"
"time"
@@ -134,6 +135,11 @@ func Init(configPath string) error {
v.SetDefault("web.path", "web")
v.SetDefault("admin.password_bcrypt", "$2a$10$fYHPeWHmwObephJvtlyH1O8DIgaLk5TINbi9BOezo2M8cSjmJchka") // 默认密码: admin123
// 绑定环境变量
v.SetEnvPrefix("BINGPAPER")
v.SetEnvKeyReplacer(strings.NewReplacer(".", "_"))
v.AutomaticEnv()
if err := v.ReadInConfig(); err != nil {
// 如果指定了配置文件但读取失败(且不是找不到文件的错误),或者没指定但也没找到
_, isNotFound := err.(viper.ConfigFileNotFoundError)