Skip to main content

Module hostname

Module hostname 

Source
Expand description

Automatic hostnames for daemons.

Every daemon that configures a port gets a hostname derived from where its configuration lives, resolved right to left against a registry of projects:

<daemon>.<worktree>.<project>.<tld>   daemon in a linked git worktree
<daemon>.<project>.<tld>              daemon in the primary checkout
<worktree>.<project>.<tld>            stack page (not a daemon)
<project>.<tld>                       project page (not a daemon)

Labels are DNS-safe lowercase. The project label is the namespace’s project name when the project declares one explicitly, otherwise the directory name of the primary checkout. The worktree label is the linked worktree’s directory name unless the config sets worktree_label.

Structs§

Checkout
Where a directory sits in a git repository.
CheckoutHosts
One checkout of a project and the daemons reachable within it.
DaemonHost
A daemon reachable under a checkout’s hostname, and how its TLS is served.
HostRegistry
All projects the proxy can route to, keyed by project label.
ProjectHosts
A project and its checkouts, keyed by hostname label.

Enums§

HostTarget
What a hostname resolves to.

Functions§

auto_host_for_daemon
The automatic hostname (without TLD) for a daemon, e.g. api.fix-1.myproj.
checkout_root_of
The root of the checkout a directory belongs to, canonicalized.
daemon_label
The daemon label for a daemon config: its name, or the proxy override.
detect_checkout
Locate the checkout containing dir by walking up to the nearest .git.
host_for_daemon
The hostname to advertise for a daemon: a legacy [slugs] entry when one exists, otherwise the automatic hostname.
hostname_fits
Whether a hostname’s labels still leave room for the configured TLD.
project_label
The project label for a primary checkout.
sanitize_label
Convert an arbitrary name into a DNS-safe lowercase label.
warn_once
Report a configuration problem once per distinct message.
worktree_label
The worktree label for a linked worktree directory.