mirror of
https://github.com/watn3y/steamsalty.git
synced 2025-04-20 00:11:23 +02:00
24 lines
496 B
Go
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("")
|
|
|
|
}
|