OXYGENHUB

Metrics token and Grafana URL from the environment 0843f23ec51c

The GCP VM's setup makes the token its collector scrapes /metrics with
and names its Grafana; the hub now takes OXYHUB_SERVER_METRICS_TOKEN and
OXYHUB_SERVER_GRAFANA_URL as it does the base URL.

Refs #212, #257 (oxygenhub-gcp#12)
Author
Andy McCall @andymccall <[email protected]>
via
agent agent:claude@andymccall <[email protected]> · keyless, under your grant for changes,refs,seal · key fa9c3fe31d27
When
· 2026-10-18 12:53 UTC
Signature
◈ sealed by agent:claude@andymccall
Hash
0843f23ec51c2e8a70e93c4f150c170714b5574df689fa154f867a0e2f56b0c1
Depends on
d23464c0ac60
Depended on by
e57765dee61a
In bookmarks
api-unknown-fields cancel-landed-runs diffusion-pin-bookmark draft-ready main oh-comment-body-file proposal-list-fast
In tags
v0.6.0 v0.6.1 v0.7.0 v0.8.0 v0.9.0 v0.9.1 v0.9.11 v0.9.15 v0.9.16 v0.9.19 v0.9.2 v0.9.20 v0.9.21 v0.9.22 v0.9.23 v0.9.24 v0.9.3 v0.9.4 v0.9.5 v0.9.6 v0.9.7 v0.9.8 v0.9.9
Edits
3 atoms, 0 tree operations, 1 file

Browse the tree at this change

modified crates/hub/src/config.rs +11 −0
…
193 unchanged lines
194 194
        if let Some(v) = get("OXYHUB_SERVER_BEHIND_PROXY") {
195 195
            self.server.behind_proxy = matches!(v.as_str(), "1" | "true" | "yes");
196 196
        }
197 +
        // The VM's setup gives these (oxygenhub-gcp#12): the token its
198 +
        // collector scrapes /metrics with, and its Grafana for Insights' link.
199 +
        if let Some(v) = get("OXYHUB_SERVER_METRICS_TOKEN") {
200 +
            self.server.metrics_token = v;
201 +
        }
202 +
        if let Some(v) = get("OXYHUB_SERVER_GRAFANA_URL") {
203 +
            self.server.grafana_url = v;
204 +
        }
197 205
        if let Some(v) = get("OXYHUB_TLS_SELF_SIGNED") {
198 206
            self.tls.self_signed = matches!(v.as_str(), "1" | "true" | "yes");
199 207
        }
…
68 unchanged lines
268 276
        cfg.apply_env(|k| match k {
269 277
            "OXYHUB_SITE_NAME" => Some("Earth".into()),
270 278
            "OXYHUB_AUTH_PUSH_TOKENS" => Some("a, b".into()),
279 +
            "OXYHUB_SERVER_METRICS_TOKEN" => Some("m".into()),
280 +
            "OXYHUB_SERVER_GRAFANA_URL" => Some("https://grafana.example".into()),
271 281
            _ => None,
272 282
        });
273 283
        assert_eq!(cfg.site.name, "Earth");
274 284
        assert_eq!(cfg.auth.push_tokens, ["a", "b"]);
285 +
        assert_eq!((cfg.server.metrics_token.as_str(), cfg.server.grafana_url.as_str()), ("m", "https://grafana.example"));
275 286
        assert!(Config::parse("[nope]\nx = 1\n").is_err(), "unknown sections are errors, not silence");
276 287
    }
277 288
}