chore(server): iex helper for host registration

This commit is contained in:
Carsten 2026-04-21 22:04:44 +02:00
parent 61595e0293
commit 9e55eae6a1

View file

@ -0,0 +1,18 @@
defmodule Server.Release do
@moduledoc "Convenience functions for IEx and future release tasks."
@doc "Create a host and print the plaintext token once."
def register_host(name) do
case Server.Hosts.create_host(name) do
{:ok, {host, token}} ->
IO.puts("Host '#{host.name}' registered (id=#{host.id}).")
IO.puts("TOKEN: #{token}")
IO.puts("Store this token NOW — it will never be shown again.")
{:ok, host, token}
{:error, cs} ->
IO.puts("Failed to register host: #{inspect(cs.errors)}")
{:error, cs}
end
end
end