prepare for google translate

This commit is contained in:
Daniel Goc
2026-03-16 08:51:35 +01:00
parent 6ff47ce1c4
commit a44885faa5
8 changed files with 198 additions and 28 deletions

View File

@@ -13,14 +13,15 @@ import (
)
type Config struct {
Server ServerConfig
Database DatabaseConfig
Auth AuthConfig
OAuth OAuthConfig
App AppConfig
Email EmailConfig
I18n I18n
Pdf PdfPrinter
Server ServerConfig
Database DatabaseConfig
Auth AuthConfig
OAuth OAuthConfig
App AppConfig
Email EmailConfig
I18n I18n
Pdf PdfPrinter
GoogleTranslate GoogleTranslateConfig
}
type I18n struct {
@@ -82,6 +83,14 @@ type PdfPrinter struct {
ServerUrl string `env:"PDF_SERVER_URL,http://localhost:8000"`
}
// GoogleTranslateConfig holds configuration for the Google Cloud Translation API.
// CredentialsFile should point to a service account JSON key file.
// ProjectID is your Google Cloud project ID (e.g. "my-project-123").
type GoogleTranslateConfig struct {
CredentialsFile string `env:"GOOGLE_APPLICATION_CREDENTIALS"`
ProjectID string `env:"GOOGLE_CLOUD_PROJECT_ID"`
}
var cfg *Config
func init() {
@@ -153,6 +162,11 @@ func load() *Config {
slog.Error("not possible to load env variables for email : ", err.Error(), "")
}
err = loadEnv(&cfg.GoogleTranslate)
if err != nil {
slog.Error("not possible to load env variables for google translate : ", err.Error(), "")
}
return cfg
}