Commit 97cfd3b1 authored by Mikko Ahlroth's avatar Mikko Ahlroth

Get correct URL scheme based on env port

parent 7b20d530
Pipeline #39526458 passed with stages
in 6 minutes and 38 seconds
......@@ -59,9 +59,11 @@ defmodule CodeStatsWeb.Endpoint do
host = get_env("HOST", :str)
host_port = get_env("HOST_PORT", :int)
url_scheme = if host_port == 443, do: "https", else: "http"
config =
Keyword.put(config, :http, port: port)
|> Keyword.put(:url, host: host, port: host_port)
|> Keyword.put(:url, host: host, port: host_port, scheme: url_scheme)
{:ok, config}
else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment