DevelopmentNodeEnvironment_MicrosoftVSCodeDependency_22NodeVersion_Bundle_Clean_Debug_ElectronProfile_EsbuildCompiler_Mountain/Binary/Build/PostHogPlugin/DistinctId.rs
1//! Machine-stable distinct ID for the dev session. When the `Brand`
2//! env var is populated, it wins - same value across every process in
3//! the same dev run. Otherwise falls back to `land-dev-<USER>`.
4
5use crate::Binary::Build::PostHogPlugin::Constants;
6
7pub fn Fn() -> String {
8 if !Constants::POSTHOG_DISTINCT_ID_SEED.is_empty() {
9 return Constants::POSTHOG_DISTINCT_ID_SEED.to_string();
10 }
11
12 let User = std::env::var("USER")
13 .or_else(|_| std::env::var("USERNAME"))
14 .unwrap_or_else(|_| "unknown".to_string());
15
16 format!("land-dev-{}", User)
17}