From eeccdde03fbe756e8f04cdcd6b0f06c2247046eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filipe=20Caba=C3=A7o?= Date: Wed, 18 Dec 2024 12:04:18 +0000 Subject: [PATCH] fix: Allow to set self host tenant name (#1249) Adds a new configurable variable to set self host tenant name. Authored-by: Scott Beardsley --- README.md | 1 + mix.exs | 2 +- priv/repo/seeds.exs | 3 +-- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 971fa3e52..8e18f152c 100644 --- a/README.md +++ b/README.md @@ -148,6 +148,7 @@ If you're using the default tenant, the URL is `ws://realtime-dev.localhost:4000 | TENANT_MAX_EVENTS_PER_SECOND | string | The default value of maximum events per second that each tenant can support, used when creating a tenant for the first time. Defaults to '100'. | | TENANT_MAX_JOINS_PER_SECOND | string | The default value of maximum channel joins per second that each tenant can support, used when creating a tenant for the first time. Defaults to '100'. | | SEED_SELF_HOST | boolean | Seeds the system with default tenant | +| SELF_HOST_TENANT_NAME | string | Tenant reference to be used for self host. Do keep in mind to use a URL compatible name | | RUN_JANITOR | boolean | Do you want to janitor tasks to run | | JANITOR_SCHEDULE_TIMER_IN_MS | number | Time in ms to run the janitor task | | JANITOR_SCHEDULE_RANDOMIZE | boolean | Adds a randomized value of minutes to the timer | diff --git a/mix.exs b/mix.exs index cf0e3e7db..f68585961 100644 --- a/mix.exs +++ b/mix.exs @@ -4,7 +4,7 @@ defmodule Realtime.MixProject do def project do [ app: :realtime, - version: "2.33.67", + version: "2.33.68", elixir: "~> 1.17.3", elixirc_paths: elixirc_paths(Mix.env()), start_permanent: Mix.env() == :prod, diff --git a/priv/repo/seeds.exs b/priv/repo/seeds.exs index d096097f8..3f666ad59 100644 --- a/priv/repo/seeds.exs +++ b/priv/repo/seeds.exs @@ -2,8 +2,7 @@ require Logger alias Realtime.{Api.Tenant, Repo} import Ecto.Adapters.SQL, only: [query: 3] -tenant_name = "realtime-dev" - +tenant_name = System.get_env("SELF_HOST_TENANT_NAME", "realtime-dev") env = if :ets.whereis(Mix.State) != :undefined, do: Mix.env(), else: :prod default_db_host = if env in [:dev, :test], do: "localhost", else: "host.docker.internal"