@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user