paramaterize CORS
This commit is contained in:
@@ -5,6 +5,8 @@ import (
|
||||
"fmt"
|
||||
"log/slog"
|
||||
"net/http"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"git.dubyatp.xyz/chat-api-server/db"
|
||||
"github.com/go-chi/chi/v5"
|
||||
@@ -36,7 +38,7 @@ func Start() {
|
||||
r := chi.NewRouter()
|
||||
|
||||
r.Use(cors.Handler(cors.Options{
|
||||
AllowedOrigins: []string{"http://localhost:5000"},
|
||||
AllowedOrigins: strings.Split(os.Getenv("ALLOWED_ORIGINS"), ","),
|
||||
AllowedMethods: []string{"GET", "POST", "PUT", "DELETE", "OPTIONS"},
|
||||
AllowedHeaders: []string{"Accept", "Authorization", "Content-Type", "X-CSRF-Token"},
|
||||
ExposedHeaders: []string{"Link"},
|
||||
|
Reference in New Issue
Block a user