From 6c2abe30251683a2de5dcb50e86095f4ea56b16b Mon Sep 17 00:00:00 2001 From: krau <71133316+krau@users.noreply.github.com> Date: Mon, 16 Jun 2025 17:11:26 +0800 Subject: [PATCH] chore: remove deprecated config --- config.example.toml | 10 ---------- config/viper.go | 11 ----------- 2 files changed, 21 deletions(-) diff --git a/config.example.toml b/config.example.toml index d81e0de..33158dd 100644 --- a/config.example.toml +++ b/config.example.toml @@ -15,7 +15,6 @@ token = "" # 初始化超时时间, 单位: 秒 timeout = 60 - # flood_retry = 5 # rpc_retry = 5 @@ -91,18 +90,9 @@ type = "telegram" enable = true chat_id = 1820371480 - -# 其他配置 - -# [log] -# # 日志等级 -# level = "DEBUG" - # [temp] # # 下载文件临时目录, 请不要在此目录下存放任何其他文件 # base_path = "cache/" -# # 临时文件保存时间, 单位: 秒 -# cache_ttl = 30 # [db] # path = "data/data.db" # 数据库文件路径 diff --git a/config/viper.go b/config/viper.go index f8c065a..c6d8a96 100644 --- a/config/viper.go +++ b/config/viper.go @@ -25,7 +25,6 @@ type Config struct { Users []userConfig `toml:"users" mapstructure:"users" json:"users"` Temp tempConfig `toml:"temp" mapstructure:"temp"` - Log logConfig `toml:"log" mapstructure:"log"` DB dbConfig `toml:"db" mapstructure:"db"` Telegram telegramConfig `toml:"telegram" mapstructure:"telegram"` Storages []storage.StorageConfig `toml:"-" mapstructure:"-" json:"storages"` @@ -36,16 +35,10 @@ type tempConfig struct { CacheTTL int64 `toml:"cache_ttl" mapstructure:"cache_ttl" json:"cache_ttl"` } -type logConfig struct { - Level string `toml:"level" mapstructure:"level"` - File string `toml:"file" mapstructure:"file"` - BackupCount uint `toml:"backup_count" mapstructure:"backup_count" json:"backup_count"` -} type dbConfig struct { Path string `toml:"path" mapstructure:"path"` Session string `toml:"session" mapstructure:"session"` - Expire int64 `toml:"expire" mapstructure:"expire"` } type telegramConfig struct { @@ -104,13 +97,9 @@ func Init(ctx context.Context) error { viper.SetDefault("telegram.userbot.session", "data/usersession.db") viper.SetDefault("temp.base_path", "cache/") - viper.SetDefault("temp.cache_ttl", 30) - - viper.SetDefault("log.level", "INFO") viper.SetDefault("db.path", "data/saveany.db") viper.SetDefault("db.session", "data/session.db") - viper.SetDefault("db.expire", 86400*5) if err := viper.SafeWriteConfigAs("config.toml"); err != nil { if _, ok := err.(viper.ConfigFileAlreadyExistsError); !ok {