feat: 配置系统 + Linux 服务安装脚本
- 新增 config/config.go:TOML 配置包,自动生成配置文件 + 缺失项补全 - Windows: conf/config.toml(基于工作目录) - Linux: /etc/portal_page/config.toml(FHS) - 配置项:data.dir, database.type(sqlite/mysql), server.addr, server.unix - Linux 默认 unix socket: /opt/portal_page/server.sock - database/db.go 重构支持 MySQL - handlers/upload.go 改用 config.GetUploadDir() - main.go 整合配置启动流程,支持 TCP/Unix socket 双模式 - 新增 install.sh:Linux 服务一键安装/卸载/管理脚本 - 拉取代码 → 编译 → 部署到 /opt/portal_page → systemd 服务 - 自动创建 portal_page 用户和 FHS 目录 - 支持 start/stop/restart/status
This commit is contained in:
@@ -79,6 +79,7 @@ func defaultConfig() *Config {
|
||||
// Linux 下遵循 FHS 标准
|
||||
if runtime.GOOS == "linux" {
|
||||
cfg.Data.Dir = "/srv/portal_page"
|
||||
cfg.Server.Unix = "/opt/portal_page/server.sock"
|
||||
}
|
||||
|
||||
return cfg
|
||||
|
||||
Reference in New Issue
Block a user