Skip to content

Commit

Permalink
[RTC-443] Support for path in Jellyfish address (fishjam-dev#142)
Browse files Browse the repository at this point in the history
  • Loading branch information
sgfn authored Jan 29, 2024
1 parent 2ca9b97 commit 6c6a1f9
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions config/runtime.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand All @@ -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
Expand Down

0 comments on commit 6c6a1f9

Please sign in to comment.