fix cors
All checks were successful
Build and Publish / build-release (push) Successful in 1m17s

This commit is contained in:
2026-04-16 16:10:01 -05:00
parent 844fc35088
commit 3a22776568
3 changed files with 8 additions and 1 deletions

View File

@@ -14,6 +14,11 @@ config :logger, level: logger_level
config :logger, :console, format: {Logger.Formatter, :format} config :logger, :console, format: {Logger.Formatter, :format}
cors_origin = System.get_env("CORS_ORIGIN", "*")
config :cors_plug,
origin: cors_origin
if System.get_env("PHX_SERVER") do if System.get_env("PHX_SERVER") do
config :customer_service, CustomerServiceWeb.Endpoint, server: true config :customer_service, CustomerServiceWeb.Endpoint, server: true
end end

View File

@@ -45,6 +45,6 @@ defmodule CustomerServiceWeb.Endpoint do
plug Plug.MethodOverride plug Plug.MethodOverride
plug Plug.Head plug Plug.Head
plug Plug.Session, @session_options plug Plug.Session, @session_options
plug CORSPlug, origin: ["http://localhost:3000"] plug CORSPlug
plug CustomerServiceWeb.Router plug CustomerServiceWeb.Router
end end

View File

@@ -44,6 +44,8 @@ controllers:
LOG_LEVEL: info LOG_LEVEL: info
MIX_ENV: prod MIX_ENV: prod
PORT: "8080" PORT: "8080"
CORS_ORIGIN:
value: "*"
PHX_HOST: "0.0.0.0" PHX_HOST: "0.0.0.0"
PHX_SERVER: "true" PHX_SERVER: "true"
DATABASE_URL: DATABASE_URL: