mirror of
https://github.com/watn3y/steamsalty.git
synced 2025-10-28 01:21:07 +01:00
feat: Automatic comment translation using DeepL
Some checks failed
Build and Push to Docker Hub on push to any branch / docker (push) Has been cancelled
Some checks failed
Build and Push to Docker Hub on push to any branch / docker (push) Has been cancelled
This commit is contained in:
parent
c6c7480493
commit
1e94b1fc1e
10 changed files with 250 additions and 20 deletions
|
|
@ -2,28 +2,31 @@ package config
|
|||
|
||||
import (
|
||||
"context"
|
||||
"strings"
|
||||
|
||||
"github.com/joho/godotenv"
|
||||
"github.com/rs/zerolog"
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/joho/godotenv"
|
||||
envconfig "github.com/sethvargo/go-envconfig"
|
||||
)
|
||||
|
||||
var BotConfig config
|
||||
|
||||
func LoadConfig() {
|
||||
|
||||
if err := godotenv.Load(); err != nil {
|
||||
if err := godotenv.Load(); err != nil {
|
||||
log.Info().Err(err).Msg("Failed to load .env file, using the system environment")
|
||||
} else {
|
||||
log.Info().Err(err).Msg(".env file loaded successfully")
|
||||
}
|
||||
|
||||
if err := envconfig.Process(context.Background(), &BotConfig); err != nil {
|
||||
log.Panic().Err(err).Msg("Failed to parse config from env variables")
|
||||
log.Fatal().Err(err).Msg("Failed to parse config from env variables")
|
||||
}
|
||||
zerolog.SetGlobalLevel(zerolog.Level(BotConfig.LogLevel))
|
||||
|
||||
BotConfig.TranslateLanguage = strings.ToUpper(BotConfig.TranslateLanguage)
|
||||
|
||||
|
||||
log.Info().Msg("Config loaded successfully")
|
||||
log.Debug().Interface("config", BotConfig).Msg("")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue