fix: issues

This commit is contained in:
Rogee
2024-09-02 23:39:22 +08:00
parent d3806983a4
commit e953d41e7a
10 changed files with 123 additions and 39 deletions

View File

@@ -14,9 +14,16 @@ type Config struct {
BotToken string `mapstructure:"bot_token"`
SessionFile string `mapstructure:"session_file"`
LogFile string `mapstructure:"log_file"`
MaxSize string `mapstructure:"max_size"`
DSN string `mapstructure:"dsn"`
}
// GetMaxSize
func (c *Config) GetMaxSize() uint {
// parse 50m to 50 * 1024 * 1024
return viper.GetSizeInBytes(c.MaxSize)
}
func Load(path string) error {
// Load the config file
viper.SetConfigFile(path)