feat(mail): #132 unify env variables and send mails with smtp
All checks were successful
Build Docker Image / Explore-Gitea-Actions (push) Successful in 46s
Build and Push Docker Image / Explore-Gitea-Actions (push) Successful in 52s

This commit was merged in pull request #153.
This commit is contained in:
Tim
2024-09-05 17:54:39 +02:00
parent c954cddc45
commit 89bc723427
7 changed files with 111 additions and 22 deletions

View File

@@ -1,21 +1,15 @@
package middleware
import (
"log"
"log/slog"
"me-fit/utils"
"net/http"
"os"
)
func EnableCors(next http.Handler) http.Handler {
var base_url = os.Getenv("BASE_URL")
if base_url == "" {
log.Fatal("BASE_URL is not set")
}
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-Origin", utils.BaseUrl)
w.Header().Set("Access-Control-Allow-Methods", "GET, POST, DELETE")
if r.Method == "OPTIONS" {