feat(config): 添加文件并发处理配置和停止功能
All checks were successful
构建上传工具 / build-tool (push) Successful in 4m1s

This commit is contained in:
2025-10-15 18:12:47 +08:00
parent 84343031e8
commit 2f5708fbc2
2 changed files with 176 additions and 79 deletions

View File

@@ -8,11 +8,12 @@ import (
)
type Config struct {
Url string `mapstructure:"url"`
Token string `mapstructure:"token"`
ThreadCount int `mapstructure:"thread-count"`
IsRunOnStart bool `mapstructure:"is-run-on-start"`
LookingPath string `mapstructure:"looking-path"`
Url string `mapstructure:"url"`
Token string `mapstructure:"token"`
ThreadCount int `mapstructure:"thread-count"`
HandleFileCount int `mapstructure:"handle-file-count"`
IsRunOnStart bool `mapstructure:"is-run-on-start"`
LookingPath string `mapstructure:"looking-path"`
}
var APPConfig Config
@@ -20,15 +21,17 @@ var APPConfig Config
func InitConfig() {
// 设置默认配置
defaultConfig := Config{
Url: "http://127.0.0.1:8080",
Token: "",
ThreadCount: 10,
IsRunOnStart: false,
LookingPath: "",
Url: "http://127.0.0.1:8080",
Token: "",
ThreadCount: 10,
HandleFileCount: 50,
IsRunOnStart: false,
LookingPath: "",
}
viper.SetDefault("url", defaultConfig.Url)
viper.SetDefault("token", defaultConfig.Token)
viper.SetDefault("thread-count", defaultConfig.ThreadCount)
viper.SetDefault("handle-file-count", defaultConfig.HandleFileCount)
viper.SetDefault("is-run-on-start", defaultConfig.IsRunOnStart)
viper.SetDefault("looking-path", defaultConfig.LookingPath)