mirror of
https://github.com/watn3y/steamsalty.git
synced 2025-10-25 09:51:02 +02:00
refactor: change translation config
This commit is contained in:
parent
f3dec30b56
commit
f445fef85a
2 changed files with 10 additions and 7 deletions
|
|
@ -8,9 +8,12 @@ type config struct {
|
|||
Watchers []uint64 `env:"STEAMSALTY_WATCHERS" required:"true"`
|
||||
TranslateEnabled bool `env:"STEAMSALTY_TRANSLATE_ENABLED" default:"false"`
|
||||
TranslateLanguage string `env:"STEAMSALTY_TRANSLATE_LANGUAGE" default:"EN-US"`
|
||||
|
||||
TelegramAPIToken string `env:"STEAMSALTY_TELEGRAMAPITOKEN" required:"true"`
|
||||
SteamAPIKey string `env:"STEAMSALTY_STEAMAPIKEY" required:"true"`
|
||||
DeepLAPIKey string `env:"STEAMSALTY_DEEPLAPIKEY"`
|
||||
DeepLFreeTier bool `env:"STEAMSALTY_DEEPLAPIFREETIER" default:"true"`
|
||||
TelegramAPIToken string `env:"STEAMSALTY_TELEGRAMAPITOKEN" required:"true"`
|
||||
SteamAPIKey string `env:"STEAMSALTY_STEAMAPIKEY" required:"true"`
|
||||
|
||||
DeepL struct {
|
||||
APIKey string `env:"APIKEY"`
|
||||
FreeTier bool `env:"FREETIER" default:"true"`
|
||||
} `env:"STEAMSALTY_DEEPL_"`
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,12 +18,12 @@ var TargetLanguages map[string]string
|
|||
func Init() {
|
||||
log.Info().Msg("Translation is enabled, creating HTTP client for DeepL API")
|
||||
baseURL := baseURLPro
|
||||
if config.BotConfig.DeepLFreeTier {
|
||||
if config.BotConfig.DeepL.FreeTier {
|
||||
baseURL = baseURLFree
|
||||
}
|
||||
|
||||
client = &apiClient{
|
||||
authKey: config.BotConfig.DeepLAPIKey,
|
||||
authKey: config.BotConfig.DeepL.APIKey,
|
||||
baseURL: baseURL,
|
||||
httpClient: &http.Client{Timeout: 30 * time.Second},
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue