Set Test environment in tests

This commit is contained in:
2025-08-10 21:01:18 +02:00
parent 1880051165
commit 84158683cd
10 changed files with 346 additions and 18 deletions
+11 -6
View File
@@ -13,7 +13,8 @@ type Config struct {
ServerPort string
// Database Konfiguration
DatabaseURL string
DatabaseURL string
DatabaseType string
// Logging Konfiguration
DebugMode bool
@@ -26,11 +27,12 @@ type Config struct {
// defaultConfig gibt die Standard-Konfiguration zurück
func defaultConfig() *Config {
return &Config{
ServerPort: "8180",
DatabaseURL: "",
DebugMode: false,
LogLevel: "INFO",
Environment: "production",
ServerPort: "8180",
DatabaseURL: "",
DatabaseType: "mysql",
DebugMode: false,
LogLevel: "INFO",
Environment: "production",
}
}
@@ -53,6 +55,9 @@ func LoadConfig() *Config {
if dbURL := os.Getenv("DATABASE_URL"); dbURL != "" {
config.DatabaseURL = dbURL
}
if dbType := os.Getenv("DATABASE_TYPE"); dbType != "" {
config.DatabaseType = strings.ToLower(dbType)
}
// Debug Mode
if debug := os.Getenv("DEBUG"); debug != "" {