From 6c6a1f93f082e6d2862c2727dfed495288f45df1 Mon Sep 17 00:00:00 2001 From: Jakub Pisarek <99591440+sgfn@users.noreply.github.com> Date: Mon, 29 Jan 2024 17:40:08 +0100 Subject: [PATCH] [RTC-443] Support for path in Jellyfish address (#142) --- config/runtime.exs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/config/runtime.exs b/config/runtime.exs index 4db977aa..68048025 100644 --- a/config/runtime.exs +++ b/config/runtime.exs @@ -23,17 +23,11 @@ host = other -> other end -{host_name, host_port} = - case String.split(host, ":") do - [host_name, host_port] -> {host_name, String.to_integer(host_port)} - _ -> {host, 443} - end - config :jellyfish, jwt_max_age: 24 * 3600, media_files_path: System.get_env("JF_RESOURCES_BASE_PATH", "jellyfish_resources") |> Path.expand(), - address: "#{host}", + address: host, metrics_ip: ConfigReader.read_ip("JF_METRICS_IP") || {127, 0, 0, 1}, metrics_port: ConfigReader.read_port("JF_METRICS_PORT") || 9568, dist_config: ConfigReader.read_dist_config(), @@ -54,10 +48,16 @@ case System.get_env("JF_SERVER_API_TOKEN") do config :jellyfish, server_api_token: token end +external_uri = URI.parse("//" <> host) + config :jellyfish, JellyfishWeb.Endpoint, secret_key_base: System.get_env("JF_SECRET_KEY_BASE") || Base.encode64(:crypto.strong_rand_bytes(48)), - url: [host: host_name, port: host_port] + url: [ + host: external_uri.host, + port: external_uri.port || 443, + path: external_uri.path || "/" + ] # In order to use HTTPS in development, a self-signed # certificate can be generated by running the following