chore: #123 unify metrics, logs, variable names and structure

This commit is contained in:
2024-09-02 22:44:59 +02:00
parent b548968ac6
commit 9666f239fe
13 changed files with 84 additions and 114 deletions

View File

@@ -2,6 +2,7 @@ package middleware
import (
"log"
"log/slog"
"net/http"
"os"
)
@@ -11,12 +12,11 @@ func EnableCors(next http.Handler) http.Handler {
if base_url == "" {
log.Fatal("BASE_URL is not set")
}
log.Println("BASE_URL is", base_url)
slog.Info("BASE_URL is " + base_url)
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Access-Control-Allow-Origin", base_url)
w.Header().Set("Access-Control-Allow-Methods", "GET, POST, DELETE")
w.Header().Set("Access-Control-Allow-Headers", "Authorization")
if r.Method == "OPTIONS" {
w.WriteHeader(http.StatusOK)