Compare commits
2 Commits
04c83cccb9
...
5782177c35
Author | SHA1 | Date | |
---|---|---|---|
5782177c35
|
|||
b7a81889a3
|
@@ -5,6 +5,8 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"log/slog"
|
"log/slog"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"os"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"git.dubyatp.xyz/chat-api-server/db"
|
"git.dubyatp.xyz/chat-api-server/db"
|
||||||
"github.com/go-chi/chi/v5"
|
"github.com/go-chi/chi/v5"
|
||||||
@@ -36,7 +38,7 @@ func Start() {
|
|||||||
r := chi.NewRouter()
|
r := chi.NewRouter()
|
||||||
|
|
||||||
r.Use(cors.Handler(cors.Options{
|
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"},
|
AllowedMethods: []string{"GET", "POST", "PUT", "DELETE", "OPTIONS"},
|
||||||
AllowedHeaders: []string{"Accept", "Authorization", "Content-Type", "X-CSRF-Token"},
|
AllowedHeaders: []string{"Accept", "Authorization", "Content-Type", "X-CSRF-Token"},
|
||||||
ExposedHeaders: []string{"Link"},
|
ExposedHeaders: []string{"Link"},
|
||||||
|
2
main.go
2
main.go
@@ -23,7 +23,7 @@ func main() {
|
|||||||
|
|
||||||
log.Logger() // initialize logger
|
log.Logger() // initialize logger
|
||||||
|
|
||||||
requiredEnvVars := []string{"SCYLLA_CLUSTER", "SCYLLA_KEYSPACE"}
|
requiredEnvVars := []string{"SCYLLA_CLUSTER", "SCYLLA_KEYSPACE", "JWT_SECRET", "ALLOWED_ORIGINS"}
|
||||||
|
|
||||||
// Initialize dotenv file
|
// Initialize dotenv file
|
||||||
err := godotenv.Load()
|
err := godotenv.Load()
|
||||||
|
Reference in New Issue
Block a user