mirror of
https://github.com/krau/SaveAny-Bot.git
synced 2026-06-08 17:10:47 +08:00
chore: remove deprecated config
This commit is contained in:
@@ -15,7 +15,6 @@ token = ""
|
|||||||
|
|
||||||
# 初始化超时时间, 单位: 秒
|
# 初始化超时时间, 单位: 秒
|
||||||
timeout = 60
|
timeout = 60
|
||||||
|
|
||||||
# flood_retry = 5
|
# flood_retry = 5
|
||||||
# rpc_retry = 5
|
# rpc_retry = 5
|
||||||
|
|
||||||
@@ -91,18 +90,9 @@ type = "telegram"
|
|||||||
enable = true
|
enable = true
|
||||||
chat_id = 1820371480
|
chat_id = 1820371480
|
||||||
|
|
||||||
|
|
||||||
# 其他配置
|
|
||||||
|
|
||||||
# [log]
|
|
||||||
# # 日志等级
|
|
||||||
# level = "DEBUG"
|
|
||||||
|
|
||||||
# [temp]
|
# [temp]
|
||||||
# # 下载文件临时目录, 请不要在此目录下存放任何其他文件
|
# # 下载文件临时目录, 请不要在此目录下存放任何其他文件
|
||||||
# base_path = "cache/"
|
# base_path = "cache/"
|
||||||
# # 临时文件保存时间, 单位: 秒
|
|
||||||
# cache_ttl = 30
|
|
||||||
|
|
||||||
# [db]
|
# [db]
|
||||||
# path = "data/data.db" # 数据库文件路径
|
# path = "data/data.db" # 数据库文件路径
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ type Config struct {
|
|||||||
Users []userConfig `toml:"users" mapstructure:"users" json:"users"`
|
Users []userConfig `toml:"users" mapstructure:"users" json:"users"`
|
||||||
|
|
||||||
Temp tempConfig `toml:"temp" mapstructure:"temp"`
|
Temp tempConfig `toml:"temp" mapstructure:"temp"`
|
||||||
Log logConfig `toml:"log" mapstructure:"log"`
|
|
||||||
DB dbConfig `toml:"db" mapstructure:"db"`
|
DB dbConfig `toml:"db" mapstructure:"db"`
|
||||||
Telegram telegramConfig `toml:"telegram" mapstructure:"telegram"`
|
Telegram telegramConfig `toml:"telegram" mapstructure:"telegram"`
|
||||||
Storages []storage.StorageConfig `toml:"-" mapstructure:"-" json:"storages"`
|
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"`
|
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 {
|
type dbConfig struct {
|
||||||
Path string `toml:"path" mapstructure:"path"`
|
Path string `toml:"path" mapstructure:"path"`
|
||||||
Session string `toml:"session" mapstructure:"session"`
|
Session string `toml:"session" mapstructure:"session"`
|
||||||
Expire int64 `toml:"expire" mapstructure:"expire"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type telegramConfig struct {
|
type telegramConfig struct {
|
||||||
@@ -104,13 +97,9 @@ func Init(ctx context.Context) error {
|
|||||||
viper.SetDefault("telegram.userbot.session", "data/usersession.db")
|
viper.SetDefault("telegram.userbot.session", "data/usersession.db")
|
||||||
|
|
||||||
viper.SetDefault("temp.base_path", "cache/")
|
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.path", "data/saveany.db")
|
||||||
viper.SetDefault("db.session", "data/session.db")
|
viper.SetDefault("db.session", "data/session.db")
|
||||||
viper.SetDefault("db.expire", 86400*5)
|
|
||||||
|
|
||||||
if err := viper.SafeWriteConfigAs("config.toml"); err != nil {
|
if err := viper.SafeWriteConfigAs("config.toml"); err != nil {
|
||||||
if _, ok := err.(viper.ConfigFileAlreadyExistsError); !ok {
|
if _, ok := err.(viper.ConfigFileAlreadyExistsError); !ok {
|
||||||
|
|||||||
Reference in New Issue
Block a user