steamsalty/config/config.go
Noah Theus 6be403fc58 v1.0
- Fixed SLEEPTIME not working (always 0)
- Refined logging
- Added metadata to /info command
- Bot now automatically sets own commands for autocompletion
2024-12-22 07:28:00 +01:00

22 lines
481 B
Go

package config
import (
"context"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
envconfig "github.com/sethvargo/go-envconfig"
)
var BotConfig config
func LoadConfig() {
if err := envconfig.Process(context.Background(), &BotConfig); err != nil {
log.Panic().Err(err).Msg("Error parsing config from env variables")
}
zerolog.SetGlobalLevel(zerolog.Level(BotConfig.LogLevel))
log.Info().Msg("Loaded config")
log.Debug().Interface("config", BotConfig).Msg("")
}