modified: main_dc/docker-compose.yml

modified:   main_dc/yalarba/api_yal/internal/router/router.go
add depends on db to api_yal service
add auth path for check healt
This commit is contained in:
2026-03-03 14:04:15 +05:00
parent a07637e9da
commit 5cd9254a97
2 changed files with 9 additions and 2 deletions
+3
View File
@@ -282,6 +282,9 @@ services:
environment:
APP_PORT: 8787
LOG_LEVEL: info
depends_on:
db:
condition: service_healthy
env_file:
- ./yalarba/api_yal/.env
networks:
@@ -10,18 +10,22 @@ import (
"gorm.io/gorm"
)
func SetupRouter(db *gorm.DB, config *config.Config) http.Handler {
zapLogger := logger.Get()
zapLogger.Info("Start setup routers")
r := chi.NewRouter()
// Health check
r.Get("/health", func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
json.NewEncoder(w).Encode(map[string]string{"status": "healthy"})
})
r.Get("/auth", func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
json.NewEncoder(w).Encode(map[string]string{"status": "ok"})
})
return r
}