From 2690449fa972dd2cceab6b7b72cde75436fcee47 Mon Sep 17 00:00:00 2001 From: Mike Cifelli Date: Wed, 5 Jun 2024 14:21:26 -0400 Subject: [PATCH] Fix deployment --- .gitignore | 3 --- config/test.exs | 2 +- lib/chronoscope/application.ex | 4 ++-- .../client_activator.ex} | 7 +++---- lib/chronoscope_web/live/index_live.ex | 4 ++-- test/priv/nts.txt => priv/nts-test.txt | 0 priv/nts.txt | 7 +++++++ 7 files changed, 15 insertions(+), 12 deletions(-) rename lib/{chronoscope/view_activator.ex => chronoscope_web/client_activator.ex} (84%) rename test/priv/nts.txt => priv/nts-test.txt (100%) create mode 100644 priv/nts.txt diff --git a/.gitignore b/.gitignore index ca8fdd9..c1b92e1 100644 --- a/.gitignore +++ b/.gitignore @@ -37,6 +37,3 @@ npm-debug.log # Ignore IDE files. .elixir_ls/ - -# Ignore server lists. -/priv/nts.txt diff --git a/config/test.exs b/config/test.exs index 79eae7f..f997ecd 100644 --- a/config/test.exs +++ b/config/test.exs @@ -10,7 +10,7 @@ config :chronoscope, ChronoscopeWeb.Endpoint, # In test we don't send emails. config :chronoscope, Chronoscope.Mailer, adapter: Swoosh.Adapters.Test -config :chronoscope, :nts_file, "test/priv/nts.txt" +config :chronoscope, :nts_file, "priv/nts-test.txt" # Disable swoosh api client as it is only required for production adapters. config :swoosh, :api_client, false diff --git a/lib/chronoscope/application.ex b/lib/chronoscope/application.ex index b984f28..2ed3a3a 100644 --- a/lib/chronoscope/application.ex +++ b/lib/chronoscope/application.ex @@ -23,8 +23,8 @@ defmodule Chronoscope.Application do {Registry, [keys: :unique, name: Chronoscope.Gemini.Registry]}, # Start to serve requests, typically the last entry ChronoscopeWeb.Endpoint, - # Initialize clients for the main LiveView - Chronoscope.ViewActivator + # Initialize clients used in the main LiveView + ChronoscopeWeb.ClientActivator ] # See https://hexdocs.pm/elixir/Supervisor.html diff --git a/lib/chronoscope/view_activator.ex b/lib/chronoscope_web/client_activator.ex similarity index 84% rename from lib/chronoscope/view_activator.ex rename to lib/chronoscope_web/client_activator.ex index 5ca763a..8ea4ae8 100644 --- a/lib/chronoscope/view_activator.ex +++ b/lib/chronoscope_web/client_activator.ex @@ -1,4 +1,4 @@ -defmodule Chronoscope.ViewActivator do +defmodule ChronoscopeWeb.ClientActivator do use GenServer require Logger @@ -14,8 +14,7 @@ defmodule Chronoscope.ViewActivator do @impl true def init(_) do - File.touch(@nts_file) - activate_nts_clients() + File.touch(Application.app_dir(:chronoscope, @nts_file)) {:ok, %{nts_servers: activate_nts_clients()}} end @@ -30,7 +29,7 @@ defmodule Chronoscope.ViewActivator do end defp activate_nts_clients() do - @nts_file + Application.app_dir(:chronoscope, @nts_file) |> File.stream!() |> Stream.map(&String.trim/1) |> Stream.filter(&(&1 != "")) diff --git a/lib/chronoscope_web/live/index_live.ex b/lib/chronoscope_web/live/index_live.ex index 7e7fb8d..a6b43e5 100644 --- a/lib/chronoscope_web/live/index_live.ex +++ b/lib/chronoscope_web/live/index_live.ex @@ -3,7 +3,7 @@ defmodule ChronoscopeWeb.IndexLive do alias Chronoscope.NTS alias Chronoscope.NTS.KeyEstablishmentResponse - alias Chronoscope.ViewActivator + alias ChronoscopeWeb.ClientActivator @topic Application.compile_env(:chronoscope, :nts_topic) @@ -25,7 +25,7 @@ defmodule ChronoscopeWeb.IndexLive do end defp server_list() do - GenServer.call(ViewActivator, :get_nts_servers) + GenServer.call(ClientActivator, :get_nts_servers) end defp client_list() do diff --git a/test/priv/nts.txt b/priv/nts-test.txt similarity index 100% rename from test/priv/nts.txt rename to priv/nts-test.txt diff --git a/priv/nts.txt b/priv/nts.txt new file mode 100644 index 0000000..45016b4 --- /dev/null +++ b/priv/nts.txt @@ -0,0 +1,7 @@ +time.cifelli.xyz +stratum1.time.cifelli.xyz +virginia.time.system76.com +paris.time.system76.com +oregon.time.system76.com +ohio.time.system76.com +brazil.time.system76.com