diff --git a/nix/agent-modules/forge.nix b/nix/agent-modules/forge.nix index 038cded1..0e4eb8e9 100644 --- a/nix/agent-modules/forge.nix +++ b/nix/agent-modules/forge.nix @@ -21,7 +21,6 @@ in { options.hyperhive.forge.url = lib.mkOption { type = lib.types.str; - default = "http://localhost:3000"; example = "http://forge.internal:3000"; description = '' Base URL of the hyperhive-managed Forgejo. Used at container @@ -31,16 +30,27 @@ in shell out to `tea` without an extra auth dance. No-op when the forge-token file is missing (i.e. hive-forge isn't running on the host). + + **Required, deliberately undefaulted.** hive-c0re renders it into + every agent's config from the host's `HIVE_FORGE_URL`, which + `hive-c0re.nix` sets unconditionally --- the forge is mandatory. + A loopback default would be a guess: the forge may run on a + different host from the agents, and inside an agent's network + namespace `localhost` reaches the agent, not the forge. An + unevaluatable config is better than one that builds and then + talks to the wrong machine. ''; }; config = { assertions = [ - # hyperhive.forge.url must look like an HTTP URL when non-default. + # The empty string is the one value the type permits that cannot + # be a URL, and it is what a caller supplies when they have + # nothing --- exactly the case the removed loopback default used + # to paper over. Reject it here so the failure names the option. { assertion = - config.hyperhive.forge.url == "" - || lib.hasPrefix "http://" config.hyperhive.forge.url + lib.hasPrefix "http://" config.hyperhive.forge.url || lib.hasPrefix "https://" config.hyperhive.forge.url; message = "hyperhive.forge.url must be an http:// or https:// URL (got: \"${config.hyperhive.forge.url}\")"; }