Fix deployment

This commit is contained in:
Mike Cifelli 2024-06-05 14:21:26 -04:00
parent 92251c4084
commit 2690449fa9
Signed by: mike
GPG Key ID: 6B08C6BE47D08E4C
7 changed files with 15 additions and 12 deletions

3
.gitignore vendored
View File

@ -37,6 +37,3 @@ npm-debug.log
# Ignore IDE files.
.elixir_ls/
# Ignore server lists.
/priv/nts.txt

View File

@ -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

View File

@ -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

View File

@ -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 != ""))

View File

@ -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

7
priv/nts.txt Normal file
View File

@ -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