mirror of
https://github.com/andwati/telecom-platform.git
synced 2026-11-14 07:55:13 +00:00
feat: Add liveness and readiness health check endpoints with database connectivity validation
- Add Ping method to PostgresProfileStore to check database connection status - Add Ping method to ProfileRepository interface - Add /api/v1/health/live endpoint for liveness checks (always returns alive if service is running) - Add /api/v1/health/ready endpoint for readiness checks with database connectivity validation - Add readinessHandler that returns SERVICE_UNAVAILABLE status when database ping fails
This commit is contained in:
@@ -144,6 +144,15 @@ func (s *PostgresProfileStore) Close() error {
|
||||
return sqlDB.Close()
|
||||
}
|
||||
|
||||
// Ping checks if the database connection is alive.
|
||||
func (s *PostgresProfileStore) Ping() error {
|
||||
sqlDB, err := s.db.DB()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return sqlDB.Ping()
|
||||
}
|
||||
|
||||
// toRow maps domain -> row. Passthrough of CreatedAt/UpdatedAt lets GORM hooks
|
||||
// populate them on first save.
|
||||
func toRow(p *Profile) *profileRow {
|
||||
|
||||
Reference in New Issue
Block a user