logging, environment und Datenbank connection

This commit is contained in:
2025-08-11 07:46:53 +02:00
parent 8874084a07
commit 4df7376e33
9 changed files with 315 additions and 71 deletions
+3 -10
View File
@@ -20,8 +20,8 @@ import (
// @BasePath /
// @schemes http
func main() {
// Konfiguration laden
cfg := config.LoadConfig()
// Verwende die globale Konfigurationsvariable (bereits in config.init() geladen)
cfg := config.Cfg
// Logger konfigurieren
logger.SetDebugMode(cfg.DebugMode)
@@ -38,6 +38,7 @@ func main() {
logger.Info("Bamort Server wird gestartet...")
logger.Debug("Debug-Modus ist aktiviert")
logger.Info("Environment: %s", cfg.Environment)
logger.Info("testingDB Set: %s", cfg.DevTesting)
logger.Info("Server Port: %s", cfg.ServerPort)
// Gin-Modus basierend auf Environment setzen
@@ -54,14 +55,6 @@ func main() {
database.ConnectDatabase()
logger.Info("Datenbankverbindung erfolgreich")
// Migrate Audit-Log table
logger.Debug("Führe Audit-Log Migration durch...")
if err := character.MigrateAuditLog(); err != nil {
logger.Error("Fehler bei Audit-Log Migration: %s", err.Error())
panic("Failed to migrate audit log table: " + err.Error())
}
logger.Debug("Audit-Log Migration erfolgreich")
r := gin.Default()
router.SetupGin(r)