hive-c0re: stop naming nix implementation files in env-var prose
Six diagnostics and eight comments explained where an environment variable comes from by naming the module file that sets it. The reader of a panic is an operator, who does not edit that file; the reader of the comment is already in the code. Neither can act on a filename, and a filename in prose is checked by nothing. Each one now names what the reader can act on: the option where there is one (services.hyperhive.network.bridgeName, .bridgeIp, .bridgePrefixLength, c0re.assets, c0re.orgAvatarPng), otherwise the unit the process is expected to run under. Two of the six diagnostics had a real option available; the other four have none, so they name the unit rather than an invented path. Four of them pointed at hive-c0re.nix, which is a directory. Two of those spelled it nix/modules/hive-c0re.nix — a directory that does not exist either, and one of the two was wrapped across a line break, so no grep for the whole path could have found it. That is the argument for the change: prose naming a file rots silently because nothing compiles it. Scope here is the four files around those diagnostics. The same pattern still matches elsewhere in the tree; that sweep follows.
This commit is contained in:
parent
f4bfd2f816
commit
ca4b56c006
4 changed files with 41 additions and 33 deletions
|
|
@ -39,7 +39,8 @@ use users::{
|
|||
const FORGE_CONTAINER: &str = "hive-forge";
|
||||
|
||||
/// Base HTTP URL for the local Forgejo instance, from `HIVE_FORGE_URL`
|
||||
/// (set unconditionally by `hive-c0re.nix` to `http://<forge.domain>`).
|
||||
/// (set unconditionally by the hyperhive NixOS module on the `hive-c0re`
|
||||
/// unit, to `http://<forge.domain>`).
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
|
|
@ -54,8 +55,9 @@ pub(crate) fn forge_http_base() -> &'static str {
|
|||
static BASE: OnceLock<String> = OnceLock::new();
|
||||
BASE.get_or_init(|| {
|
||||
std::env::var("HIVE_FORGE_URL").expect(
|
||||
"HIVE_FORGE_URL is unset — hive-c0re.nix sets it unconditionally, \
|
||||
so this process was started outside the NixOS module",
|
||||
"HIVE_FORGE_URL is unset — the hyperhive NixOS module sets it \
|
||||
unconditionally on the hive-c0re unit, so this process was \
|
||||
started outside that unit",
|
||||
)
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue