Skip to content

Commit

Permalink
Update arena's gateway_url from staging configurator only
Browse files Browse the repository at this point in the history
  • Loading branch information
Nico-Sanchez committed Sep 12, 2024
1 parent 894586f commit 47438bd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/central-europe-staging-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
MIX_ENV: ${{ vars.MIX_ENV }}
RELEASE: central_backend
PHX_SERVER: ${{ vars.PHX_SERVER }}
PHX_HOST: ${{ vars.HOST }}
PHX_HOST: ${{ vars.PHX_HOST_STAGING }}
PORT: ${{ vars.ARENA_PORT }}
GOOGLE_CLIENT_ID: ${{ vars.GOOGLE_CLIENT_ID }}
CONFIGURATOR_HOST: ${{ vars.CONFIGURATOR_HOST }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,18 +73,18 @@ defmodule ConfiguratorWeb.ArenaServerController do
defp update_arena_gateway_url(former_url, former_url, _arena_url), do: nil

defp update_arena_gateway_url(_former_url, new_url, arena_url) do
payload = Jason.encode!(%{gateway_url: new_url})

arena_url =
if String.contains?(arena_url, "localhost") do
"http://" <> arena_url
else
"https://" <> arena_url
end

spawn(fn ->
Finch.build(:post, arena_url <> "/api/update_central", [{"content-type", "application/json"}], payload)
|> Finch.request(Gateway.Finch)
end)
if System.get_env("PHX_HOST") == "central-europe-staging.championsofmirra.com" do
payload = Jason.encode!(%{gateway_url: new_url})

spawn(fn ->
Finch.build(
:post,
"https://" <> arena_url <> "/api/update_central",
[{"content-type", "application/json"}],
payload
)
|> Finch.request(Gateway.Finch)
end)
end
end
end

0 comments on commit 47438bd

Please sign in to comment.