feat(config): 添加两个令牌配置选项
构建上传工具 / build (push) Successful in 3m26s

This commit is contained in:
2026-07-26 18:13:16 +08:00
parent b0ee886b75
commit 70c903f876
+8
View File
@@ -11,6 +11,8 @@ import (
type Config struct {
Url string `json:"url" mapstructure:"url"`
Token string `json:"token" mapstructure:"token"`
HasVideoToken string `json:"has_video_token" mapstructure:"has-video-token"`
NoVideoToken string `json:"no_video_token" mapstructure:"no-video-token"`
ThreadCount int `json:"thread_count" mapstructure:"thread-count"`
HandleFileCount int `json:"handle_file_count" mapstructure:"handle-file-count"`
IsRunOnStart bool `json:"is_run_on_start" mapstructure:"is-run-on-start"`
@@ -24,6 +26,8 @@ var configMu sync.Mutex
const (
Url = "url"
Token = "token"
HasVideoToken = "has-video-token"
NoVideoToken = "no-video-token"
ThreadCount = "thread-count"
HandleFileCount = "handle-file-count"
IsRunOnStart = "is-run-on-start"
@@ -36,6 +40,8 @@ func InitConfig() {
defaultConfig := Config{
Url: "http://127.0.0.1:8080",
Token: "",
HasVideoToken: "1234",
NoVideoToken: "5678",
ThreadCount: 10,
HandleFileCount: 25,
IsRunOnStart: false,
@@ -44,6 +50,8 @@ func InitConfig() {
}
viper.SetDefault(Url, defaultConfig.Url)
viper.SetDefault(Token, defaultConfig.Token)
viper.SetDefault(HasVideoToken, defaultConfig.HasVideoToken)
viper.SetDefault(NoVideoToken, defaultConfig.NoVideoToken)
viper.SetDefault(ThreadCount, defaultConfig.ThreadCount)
viper.SetDefault(HandleFileCount, defaultConfig.HandleFileCount)
viper.SetDefault(IsRunOnStart, defaultConfig.IsRunOnStart)