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

This commit is contained in:
Tim
2024-09-06 16:17:49 +02:00
parent 2c23a508ec
commit 6669e4adab
7 changed files with 105 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" {