server: 平台抽象层+bilibili、服务端加密凭据库、角色中间件;web: 精简页面/路由、macOS 客户端(Swift)与多份方案文档;移除误入库的编译产物
This commit is contained in:
@@ -7,16 +7,21 @@ import (
|
||||
|
||||
// Config 服务器配置(环境变量优先,.env 兜底)
|
||||
type Config struct {
|
||||
ServerAddr string
|
||||
MySQLDSN string
|
||||
RedisAddr string
|
||||
RedisPass string
|
||||
JWTSecret string
|
||||
BaseURL string
|
||||
PublicBaseURL string // 浏览器侧访问地址(邀请链接等)
|
||||
StorageDir string
|
||||
StaticDir string // 前端生产构建目录(空=不托管静态)
|
||||
MaxUploadBytes int64 // multipart 上传体积上限
|
||||
ServerAddr string
|
||||
MySQLDSN string
|
||||
RedisAddr string
|
||||
RedisPass string
|
||||
JWTSecret string
|
||||
BaseURL string
|
||||
PublicBaseURL string // 浏览器侧访问地址(邀请链接等)
|
||||
StorageDir string
|
||||
CredentialDir string // 平台登录凭据加密目录
|
||||
StaticDir string // 前端生产构建目录(空=不托管静态)
|
||||
MaxUploadBytes int64 // multipart 上传体积上限
|
||||
ExecutorMode string // mock=本地联调;web=启用已注册平台适配器并保留未接入平台 mock fallback
|
||||
BilibiliMemberBase string
|
||||
BilibiliPassportBase string
|
||||
BilibiliUpOSScheme string
|
||||
}
|
||||
|
||||
// Load 从环境变量加载
|
||||
@@ -28,16 +33,21 @@ func Load() *Config {
|
||||
println("!! [security] JWT_SECRET 使用默认值或长度不足(<16)。生产环境必须设置强随机 JWT_SECRET,否则任何人都能伪造令牌(admin 提权)。")
|
||||
}
|
||||
return &Config{
|
||||
ServerAddr: getenv("SERVER_ADDR", ":8090"),
|
||||
MySQLDSN: getenv("MYSQL_DSN", "root:everypublish@tcp(127.0.0.1:3306)/everypublish?charset=utf8mb4&parseTime=True&loc=Local"),
|
||||
RedisAddr: getenv("REDIS_ADDR", "127.0.0.1:6379"),
|
||||
RedisPass: getenv("REDIS_PASSWORD", ""),
|
||||
JWTSecret: jwt,
|
||||
BaseURL: getenv("BASE_URL", "http://127.0.0.1:8090"),
|
||||
PublicBaseURL: getenv("PUBLIC_BASE_URL", getenv("BASE_URL", "http://127.0.0.1:8090")),
|
||||
StorageDir: getenv("STORAGE_DIR", "./data/materials"),
|
||||
StaticDir: getenv("STATIC_DIR", "../apps/web/dist"),
|
||||
MaxUploadBytes: getenvInt64("MAX_UPLOAD_BYTES", 2<<30),
|
||||
ServerAddr: getenv("SERVER_ADDR", ":8090"),
|
||||
MySQLDSN: getenv("MYSQL_DSN", "root:everypublish@tcp(127.0.0.1:3306)/everypublish?charset=utf8mb4&parseTime=True&loc=Local"),
|
||||
RedisAddr: getenv("REDIS_ADDR", "127.0.0.1:6379"),
|
||||
RedisPass: getenv("REDIS_PASSWORD", ""),
|
||||
JWTSecret: jwt,
|
||||
BaseURL: getenv("BASE_URL", "http://127.0.0.1:8090"),
|
||||
PublicBaseURL: getenv("PUBLIC_BASE_URL", getenv("BASE_URL", "http://127.0.0.1:8090")),
|
||||
StorageDir: getenv("STORAGE_DIR", "./data/materials"),
|
||||
CredentialDir: getenv("CREDENTIAL_DIR", "./data/credentials"),
|
||||
StaticDir: getenv("STATIC_DIR", "../apps/web/dist"),
|
||||
MaxUploadBytes: getenvInt64("MAX_UPLOAD_BYTES", 2<<30),
|
||||
ExecutorMode: getenv("EXECUTOR_MODE", "mock"),
|
||||
BilibiliMemberBase: getenv("BILIBILI_MEMBER_BASE", "https://member.bilibili.com"),
|
||||
BilibiliPassportBase: getenv("BILIBILI_PASSPORT_BASE", "https://passport.bilibili.com"),
|
||||
BilibiliUpOSScheme: getenv("BILIBILI_UPOS_SCHEME", "https"),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user