1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
//! Process-wide worker environment helpers.
//!
//! The worker exports control-plane details once during startup so spawned Git
//! helpers can authenticate against the server. The current implementation
//! uses `std::env::set_var` because external tools (git credential helper
//! scripts, commit-msg hooks) read these values from the process environment.
//!
//! # Thread Safety
//!
//! `std::env::set_var` is inherently unsafe in multi-threaded programs.
//! This function is called exactly once during worker startup, before the
//! Tokio runtime spawns any async tasks. A `OnceLock` guard ensures the
//! write cannot race with itself. Future refactors should pass these values
//! explicitly via `.env()` on each child `Command` instead.
//!
//! # Examples
//!
//! ```ignore
//! export_worker_runtime_env("https://api.codetether.run", &None, "wrk_1");
//! ```
use OnceLock;
/// Guard ensuring `export_worker_runtime_env` runs at most once.
static EXPORTED: = new;
/// Exports worker runtime variables used by downstream Git helpers.
///
/// The worker writes these values exactly once near startup before child
/// processes inherit the environment. Panics if called more than once.
///
/// # Examples
///
/// ```ignore
/// export_worker_runtime_env("https://api.codetether.run", &None, "wrk_1");
/// ```
pub