elektrine/apps/elektrine_dns/lib/mix/tasks/elektrine.dns.ensure_profile_wildcard.ex
Maxfield Luke 454e80a8f8
Some checks failed
Deploy Docker Images / Build, push, and deploy (push) Failing after 19m8s
Smoke / Hello from Forgejo Actions (push) Successful in 1s
Initial commit
Fresh repository on git.elektrine.com/elektrine/elektrine.
2026-07-30 01:36:18 -04:00

30 lines
872 B
Elixir

defmodule Mix.Tasks.Elektrine.Dns.EnsureProfileWildcard do
use Mix.Task
@shortdoc "Ensure the *.<profile-base> wildcard DNS catch-all records exist"
@moduledoc """
Ensures a proxied wildcard record (`*.<base>`) exists in every configured
profile base-domain zone, so every built-in profile subdomain resolves to the
edge even when the user never provisioned their own built-in zone.
Idempotent. Safe to run repeatedly.
mix elektrine.dns.ensure_profile_wildcard
In a release (no Mix), call the underlying function from a remote console
instead:
Elektrine.DNS.ensure_profile_subdomain_wildcards()
"""
@impl true
def run(_args) do
Mix.Task.run("app.start")
Elektrine.DNS.ensure_profile_subdomain_wildcards()
|> Enum.each(fn {domain, result} ->
Mix.shell().info("#{domain}: #{inspect(result)}")
end)
end
end