diff --git a/config/runtime.exs b/config/runtime.exs index 47b4e331..5608f942 100644 --- a/config/runtime.exs +++ b/config/runtime.exs @@ -20,7 +20,7 @@ ip = ConfigReader.read_ip("FJ_IP") || Application.fetch_env!(:fishjam, :ip) port = ConfigReader.read_port("FJ_PORT") || Application.fetch_env!(:fishjam, :port) host = - case System.get_env("FJ_HOST") do + case ConfigReader.read_string("FJ_HOST") do nil -> "#{:inet.ntoa(ip)}:#{port}" other -> other end @@ -31,7 +31,7 @@ sip_used? = Fishjam.Component.SIP in components_used config :fishjam, jwt_max_age: 24 * 3600, media_files_path: - System.get_env("FJ_RESOURCES_BASE_PATH", "fishjam_resources") |> Path.expand(), + ConfigReader.read_string("FJ_RESOURCES_BASE_PATH", "fishjam_resources") |> Path.expand(), address: host, metrics_ip: ConfigReader.read_ip("FJ_METRICS_IP") || {127, 0, 0, 1}, metrics_port: ConfigReader.read_port("FJ_METRICS_PORT") || 9568, @@ -42,7 +42,7 @@ config :fishjam, s3_config: ConfigReader.read_s3_config(), git_commit: ConfigReader.read_git_commit() -case System.get_env("FJ_SERVER_API_TOKEN") do +case ConfigReader.read_string("FJ_SERVER_API_TOKEN") do nil when prod? == true -> raise """ environment variable FJ_SERVER_API_TOKEN is missing. @@ -61,7 +61,7 @@ external_uri = URI.parse("//" <> host) config :fishjam, FishjamWeb.Endpoint, secret_key_base: - System.get_env("FJ_SECRET_KEY_BASE") || Base.encode64(:crypto.strong_rand_bytes(48)), + ConfigReader.read_string("FJ_SECRET_KEY_BASE") || Base.encode64(:crypto.strong_rand_bytes(48)), url: [ host: external_uri.host, port: external_uri.port || 443, diff --git a/lib/jellyfish/config_reader.ex b/lib/jellyfish/config_reader.ex index f22be44f..f4a23671 100644 --- a/lib/jellyfish/config_reader.ex +++ b/lib/jellyfish/config_reader.ex @@ -246,6 +246,10 @@ defmodule Fishjam.ConfigReader do get_env("FJ_GIT_COMMIT", "dev") end + def read_string(string, default \\ nil) do + get_env(string, default) + end + defp do_read_nodes_list_config(node_name_value, cookie, mode) do nodes_value = get_env("FJ_DIST_NODES", "") diff --git a/mix.exs b/mix.exs index d28181eb..d9a3372c 100644 --- a/mix.exs +++ b/mix.exs @@ -4,7 +4,7 @@ defmodule Fishjam.MixProject do def project do [ app: :fishjam, - version: "0.6.0", + version: "0.6.1", elixir: "~> 1.14", elixirc_paths: elixirc_paths(Mix.env()), start_permanent: Mix.env() == :prod, diff --git a/openapi.yaml b/openapi.yaml index 9ad53ddf..c67ac562 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -835,7 +835,7 @@ info: name: Apache 2.0 url: https://www.apache.org/licenses/LICENSE-2.0 title: Fishjam Media Server - version: 0.6.0 + version: 0.6.1 openapi: 3.0.0 paths: /health: