fix
This commit is contained in:
+8
-9
@@ -2,20 +2,19 @@ package handlers
|
||||
|
||||
import (
|
||||
"authentication/db"
|
||||
"authentication/helper"
|
||||
"authentication/models"
|
||||
"authentication/redisclient"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
"time"
|
||||
)
|
||||
|
||||
func HealthHandler(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
w.WriteHeader(http.StatusOK)
|
||||
json.NewEncoder(w).Encode(models.HealthResponse{
|
||||
Status: "ok",
|
||||
})
|
||||
response := models.HealthResponse{
|
||||
Status: "AuthN Capy!",
|
||||
}
|
||||
helper.RespondWithJSON(w, http.StatusOK, response)
|
||||
}
|
||||
|
||||
// ReadyHandler checks if the service is ready to handle requests
|
||||
@@ -62,15 +61,15 @@ func ReadyHandler(w http.ResponseWriter, r *http.Request) {
|
||||
allHealthy = false
|
||||
}
|
||||
|
||||
status := "ready"
|
||||
status := "Capy!"
|
||||
statusCode := http.StatusOK
|
||||
if !allHealthy {
|
||||
status = "not_ready"
|
||||
status = "not Capy!"
|
||||
statusCode = http.StatusServiceUnavailable
|
||||
}
|
||||
|
||||
w.WriteHeader(statusCode)
|
||||
json.NewEncoder(w).Encode(models.HealthResponse{
|
||||
helper.RespondWithJSON(w, statusCode, models.HealthResponse{
|
||||
Status: status,
|
||||
Services: services,
|
||||
})
|
||||
|
||||
+1
-1
@@ -51,7 +51,7 @@ func init() {
|
||||
keyPath = "rsa/psa.gov.ph.key"
|
||||
}
|
||||
|
||||
keyData, err := os.ReadFile(keyPath)
|
||||
keyData, err := os.ReadFile(keyPath) // #nosec G304
|
||||
if err != nil {
|
||||
if isTestEnvironment() {
|
||||
log.Printf("Failed to read RSA private key file at %s, generating test key: %v", keyPath, err)
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
csrfTokenHeader = "X-CSRF-Token"
|
||||
csrfTokenHeader = "X-CSRF-Token" // #nosec G101
|
||||
csrfCookieName = "csrf_token"
|
||||
csrfTokenLength = 32
|
||||
csrfTokenTTL = 24 * time.Hour
|
||||
|
||||
Reference in New Issue
Block a user