steamsalty/config/config.go
2024-12-20 02:09:07 +01:00

24 lines
496 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")
}
if !BotConfig.DebugMode {
zerolog.SetGlobalLevel(zerolog.InfoLevel)
}
log.Info().Msg("Loaded config")
log.Debug().Interface("config", BotConfig).Msg("")
}