feat: Tag管理功能 + 打包脚本优化 + CI/CD发布流水线
- 新增标签管理: 列表/创建/删除/推送标签 (后端API + 前端UI) - 前端新增标签Tab页,支持创建、删除、推送操作 - config.go 改为从可执行文件同目录加载 config.yaml - 各平台构建脚本自动复制 config.yaml 到输出目录 - Windows 打包改为 ZIP 格式 (不依赖 NSIS) - 新增 GitHub Actions Release 工作流 (三平台自动构建+发布)
This commit is contained in:
@@ -3,6 +3,7 @@ package config
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"gopkg.in/yaml.v3"
|
||||
)
|
||||
@@ -35,9 +36,18 @@ type AppConfig struct {
|
||||
Settings Settings `yaml:"settings"`
|
||||
}
|
||||
|
||||
// configPath 返回 config.yaml 的绝对路径(与可执行文件同目录)
|
||||
func configPath() string {
|
||||
exe, err := os.Executable()
|
||||
if err != nil {
|
||||
return "config.yaml"
|
||||
}
|
||||
return filepath.Join(filepath.Dir(exe), "config.yaml")
|
||||
}
|
||||
|
||||
// LoadConfig 从 config.yaml 文件加载配置
|
||||
func LoadConfig() (*AppConfig, error) {
|
||||
file, err := os.Open("config.yaml")
|
||||
file, err := os.Open(configPath())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -55,7 +65,7 @@ func LoadConfig() (*AppConfig, error) {
|
||||
|
||||
// SaveConfig 将配置保存到 config.yaml 文件
|
||||
func SaveConfig(config *AppConfig) error {
|
||||
file, err := os.OpenFile("config.yaml", os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0o644)
|
||||
file, err := os.OpenFile(configPath(), os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0o644)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user