fix: restructure env handling for better testing capabillities #181
This commit was merged in pull request #195.
This commit is contained in:
@@ -1,15 +1,15 @@
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"me-fit/utils"
|
||||
"me-fit/types"
|
||||
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func EnableCors(next http.Handler) http.Handler {
|
||||
func EnableCors(serverSettings *types.ServerSettings, next http.Handler) http.Handler {
|
||||
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Access-Control-Allow-Origin", utils.BaseUrl)
|
||||
w.Header().Set("Access-Control-Allow-Origin", serverSettings.BaseUrl)
|
||||
w.Header().Set("Access-Control-Allow-Methods", "GET, POST, DELETE")
|
||||
|
||||
if r.Method == "OPTIONS" {
|
||||
|
||||
Reference in New Issue
Block a user