mirror of
https://github.com/watn3y/steamsalty.git
synced 2025-04-20 00:11:23 +02:00
- Fixed SLEEPTIME not working (always 0) - Refined logging - Added metadata to /info command - Bot now automatically sets own commands for autocompletion
22 lines
481 B
Go
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("")
|
|
|
|
}
|