🐛 fix: BDD tests PostgreSQL connection for native execution

- Simplify getPostgresHost() to always use localhost by default
- Use DLC_DATABASE_HOST=localhost for all local execution
- Container name only needed when running INSIDE Docker containers
- Fix native execution PostgreSQL connection issues
- Ensure BDD tests connect to localhost:5432 (mapped port)

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
2026-04-07 23:52:57 +02:00
parent 6c2399bea6
commit f8474b69c1
2 changed files with 6 additions and 7 deletions

View File

@@ -24,11 +24,8 @@ func getPostgresHost() string {
return host
}
// Default to localhost for native execution, container name for Docker
// Check if we're running in a container by looking for Docker-specific env vars
if os.Getenv("DOCKER_CONTAINER") != "" || os.Getenv("KUBERNETES_SERVICE_HOST") != "" {
return "dance-lessons-coach-postgres"
}
// Native execution - use localhost with container port mapping
// When running natively but PostgreSQL is in Docker, use localhost (port mapping)
// When running in Docker containers, use container name
return "localhost"
}