Skip to content

Commit

Permalink
set secure cookie if BASE_URL scheme is HTTPS (#4623)
Browse files Browse the repository at this point in the history
  • Loading branch information
ruslandoga authored Sep 26, 2024
1 parent 87dac3b commit cb365c2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion config/runtime.exs
Original file line number Diff line number Diff line change
Expand Up @@ -296,9 +296,15 @@ if byte_size(websocket_url) > 0 and
"""
end

secure_cookie_default =
case base_url.scheme do
"http" -> "false"
"https" -> "true"
end

secure_cookie =
config_dir
|> get_var_from_path_or_env("SECURE_COOKIE", if(is_selfhost, do: "false", else: "true"))
|> get_var_from_path_or_env("SECURE_COOKIE", secure_cookie_default)
|> String.to_existing_atom()

license_key = get_var_from_path_or_env(config_dir, "LICENSE_KEY", "")
Expand Down

0 comments on commit cb365c2

Please sign in to comment.