Skip to main content

dynamo_runtime/config/
environment_names.rs

1// SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2// SPDX-License-Identifier: Apache-2.0
3
4//! Environment variable name constants for centralized management across the codebase
5//!
6//! This module provides centralized environment variable name constants to ensure
7//! consistency and avoid duplication across the codebase, similar to how
8//! `prometheus_names.rs` manages metric names.
9//!
10//! ## Organization
11//!
12//! Environment variables are organized by functional area:
13//! - **Logging**: Log level, configuration, and OTLP tracing
14//! - **Runtime**: Tokio runtime configuration and system server settings
15//! - **NATS**: NATS client connection and authentication
16//! - **ETCD**: ETCD client connection and authentication
17//! - **TCP Response Stream**: TCP response stream server (CallHome) port and host
18//! - **Event Plane**: Event transport selection (NATS)
19//! - **KVBM**: Key-Value Block Manager configuration
20//! - **LLM**: Language model inference configuration
21//! - **Model**: Model loading and caching
22//! - **Worker**: Worker lifecycle and shutdown
23//! - **Testing**: Test-specific configuration
24//! - **Mocker**: Mocker (mock scheduler/KV manager) configuration
25
26/// Logging and tracing environment variables
27pub mod logging {
28    /// Log level (e.g., "debug", "info", "warn", "error")
29    pub const DYN_LOG: &str = "DYN_LOG";
30
31    /// Path to logging configuration file
32    pub const DYN_LOGGING_CONFIG_PATH: &str = "DYN_LOGGING_CONFIG_PATH";
33
34    /// Enable JSONL logging format
35    pub const DYN_LOGGING_JSONL: &str = "DYN_LOGGING_JSONL";
36
37    /// Disable ANSI terminal colors in logs
38    pub const DYN_SDK_DISABLE_ANSI_LOGGING: &str = "DYN_SDK_DISABLE_ANSI_LOGGING";
39
40    /// Use local timezone for logging timestamps (default is UTC)
41    pub const DYN_LOG_USE_LOCAL_TZ: &str = "DYN_LOG_USE_LOCAL_TZ";
42
43    /// Enable span event logging (create/close events)
44    pub const DYN_LOGGING_SPAN_EVENTS: &str = "DYN_LOGGING_SPAN_EVENTS";
45
46    /// OTLP (OpenTelemetry Protocol) tracing and logging configuration
47    pub mod otlp {
48        /// Enable OTLP export for traces and logs (set to "1" to enable)
49        pub const OTEL_EXPORT_ENABLED: &str = "OTEL_EXPORT_ENABLED";
50
51        /// OTLP exporter endpoint URL for traces
52        /// Spec: https://opentelemetry.io/docs/specs/otel/protocol/exporter/
53        pub const OTEL_EXPORTER_OTLP_TRACES_ENDPOINT: &str = "OTEL_EXPORTER_OTLP_TRACES_ENDPOINT";
54
55        /// OTLP exporter endpoint URL for logs (defaults to traces endpoint if unset)
56        pub const OTEL_EXPORTER_OTLP_LOGS_ENDPOINT: &str = "OTEL_EXPORTER_OTLP_LOGS_ENDPOINT";
57
58        /// Service name for OTLP traces and logs
59        pub const OTEL_SERVICE_NAME: &str = "OTEL_SERVICE_NAME";
60    }
61}
62
63/// Runtime configuration environment variables
64///
65/// These control the Tokio runtime, system health/metrics server, and worker behavior
66pub mod runtime {
67    /// Number of async worker threads for Tokio runtime
68    pub const DYN_RUNTIME_NUM_WORKER_THREADS: &str = "DYN_RUNTIME_NUM_WORKER_THREADS";
69
70    /// Maximum number of blocking threads for Tokio runtime
71    pub const DYN_RUNTIME_MAX_BLOCKING_THREADS: &str = "DYN_RUNTIME_MAX_BLOCKING_THREADS";
72
73    /// Enable Tokio task poll-time histogram (calls enable_metrics_poll_time_histogram on builder).
74    /// Set to "1", "true", or "yes" to enable. Adds ~2× overhead of Instant::now() per task poll.
75    pub const DYN_ENABLE_POLL_HISTOGRAM: &str = "DYN_ENABLE_POLL_HISTOGRAM";
76
77    /// System status server configuration
78    pub mod system {
79        /// Enable system status server for health and metrics endpoints
80        /// ⚠️ DEPRECATED: will be removed soon
81        pub const DYN_SYSTEM_ENABLED: &str = "DYN_SYSTEM_ENABLED";
82
83        /// System status server host
84        pub const DYN_SYSTEM_HOST: &str = "DYN_SYSTEM_HOST";
85
86        /// System status server port
87        pub const DYN_SYSTEM_PORT: &str = "DYN_SYSTEM_PORT";
88
89        /// Use endpoint health status for system health
90        /// ⚠️ DEPRECATED: No longer used
91        pub const DYN_SYSTEM_USE_ENDPOINT_HEALTH_STATUS: &str =
92            "DYN_SYSTEM_USE_ENDPOINT_HEALTH_STATUS";
93
94        /// Starting health status for the system
95        pub const DYN_SYSTEM_STARTING_HEALTH_STATUS: &str = "DYN_SYSTEM_STARTING_HEALTH_STATUS";
96
97        /// Health check endpoint path
98        pub const DYN_SYSTEM_HEALTH_PATH: &str = "DYN_SYSTEM_HEALTH_PATH";
99
100        /// Liveness check endpoint path
101        pub const DYN_SYSTEM_LIVE_PATH: &str = "DYN_SYSTEM_LIVE_PATH";
102    }
103
104    /// Compute configuration
105    pub mod compute {
106        /// Prefix for compute-related environment variables
107        pub const PREFIX: &str = "DYN_COMPUTE_";
108    }
109
110    /// Canary deployment configuration
111    pub mod canary {
112        /// Wait time in seconds for canary deployments
113        pub const DYN_CANARY_WAIT_TIME: &str = "DYN_CANARY_WAIT_TIME";
114    }
115}
116
117/// Worker lifecycle environment variables
118pub mod worker {
119    /// Graceful shutdown timeout in seconds
120    pub const DYN_WORKER_GRACEFUL_SHUTDOWN_TIMEOUT: &str = "DYN_WORKER_GRACEFUL_SHUTDOWN_TIMEOUT";
121}
122
123/// NATS transport environment variables
124pub mod nats {
125    /// NATS server address (e.g., "nats://localhost:4222")
126    pub const NATS_SERVER: &str = "NATS_SERVER";
127
128    /// NATS authentication environment variables (checked in priority order)
129    pub mod auth {
130        /// Username for NATS authentication (use with NATS_AUTH_PASSWORD)
131        pub const NATS_AUTH_USERNAME: &str = "NATS_AUTH_USERNAME";
132
133        /// Password for NATS authentication (use with NATS_AUTH_USERNAME)
134        pub const NATS_AUTH_PASSWORD: &str = "NATS_AUTH_PASSWORD";
135
136        /// Token for NATS authentication
137        pub const NATS_AUTH_TOKEN: &str = "NATS_AUTH_TOKEN";
138
139        /// NKey for NATS authentication
140        pub const NATS_AUTH_NKEY: &str = "NATS_AUTH_NKEY";
141
142        /// Path to NATS credentials file
143        pub const NATS_AUTH_CREDENTIALS_FILE: &str = "NATS_AUTH_CREDENTIALS_FILE";
144    }
145
146    /// NATS stream configuration
147    pub mod stream {
148        /// Maximum age for messages in NATS stream (in seconds)
149        pub const DYN_NATS_STREAM_MAX_AGE: &str = "DYN_NATS_STREAM_MAX_AGE";
150    }
151}
152
153/// ETCD transport environment variables
154pub mod etcd {
155    /// ETCD endpoints (comma-separated list of URLs)
156    pub const ETCD_ENDPOINTS: &str = "ETCD_ENDPOINTS";
157
158    /// ETCD authentication environment variables
159    pub mod auth {
160        /// Username for ETCD authentication
161        pub const ETCD_AUTH_USERNAME: &str = "ETCD_AUTH_USERNAME";
162
163        /// Password for ETCD authentication
164        pub const ETCD_AUTH_PASSWORD: &str = "ETCD_AUTH_PASSWORD";
165
166        /// Path to CA certificate for ETCD TLS
167        pub const ETCD_AUTH_CA: &str = "ETCD_AUTH_CA";
168
169        /// Path to client certificate for ETCD TLS
170        pub const ETCD_AUTH_CLIENT_CERT: &str = "ETCD_AUTH_CLIENT_CERT";
171
172        /// Path to client key for ETCD TLS
173        pub const ETCD_AUTH_CLIENT_KEY: &str = "ETCD_AUTH_CLIENT_KEY";
174    }
175}
176
177/// Key-Value Block Manager (KVBM) environment variables
178pub mod kvbm {
179    /// Enable KVBM metrics endpoint
180    pub const DYN_KVBM_METRICS: &str = "DYN_KVBM_METRICS";
181
182    /// KVBM metrics endpoint port
183    pub const DYN_KVBM_METRICS_PORT: &str = "DYN_KVBM_METRICS_PORT";
184
185    /// Enable KVBM recording for debugging.
186    pub const DYN_KVBM_ENABLE_RECORD: &str = "DYN_KVBM_ENABLE_RECORD";
187
188    /// Disable disk offload filter
189    pub const DYN_KVBM_DISABLE_DISK_OFFLOAD_FILTER: &str = "DYN_KVBM_DISABLE_DISK_OFFLOAD_FILTER";
190
191    /// CPU cache configuration
192    pub mod cpu_cache {
193        /// CPU cache size in GB
194        pub const DYN_KVBM_CPU_CACHE_GB: &str = "DYN_KVBM_CPU_CACHE_GB";
195
196        /// CPU cache size in number of blocks (override)
197        pub const DYN_KVBM_CPU_CACHE_OVERRIDE_NUM_BLOCKS: &str =
198            "DYN_KVBM_CPU_CACHE_OVERRIDE_NUM_BLOCKS";
199    }
200
201    /// Disk cache configuration
202    pub mod disk_cache {
203        /// Disk cache size in GB
204        pub const DYN_KVBM_DISK_CACHE_GB: &str = "DYN_KVBM_DISK_CACHE_GB";
205
206        /// Disk cache size in number of blocks (override)
207        pub const DYN_KVBM_DISK_CACHE_OVERRIDE_NUM_BLOCKS: &str =
208            "DYN_KVBM_DISK_CACHE_OVERRIDE_NUM_BLOCKS";
209    }
210
211    /// Object storage configuration
212    pub mod object_storage {
213        /// Enable object storage. Set to "1" to enable.
214        pub const DYN_KVBM_OBJECT_ENABLED: &str = "DYN_KVBM_OBJECT_ENABLED";
215
216        /// Bucket name for object storage cache
217        /// Supports `{worker_id}` template for per-worker buckets
218        /// Example: "kv-cache-{worker_id}"
219        pub const DYN_KVBM_OBJECT_BUCKET: &str = "DYN_KVBM_OBJECT_BUCKET";
220
221        /// Endpoint for object storage
222        pub const DYN_KVBM_OBJECT_ENDPOINT: &str = "DYN_KVBM_OBJECT_ENDPOINT";
223
224        /// Region for object storage
225        pub const DYN_KVBM_OBJECT_REGION: &str = "DYN_KVBM_OBJECT_REGION";
226
227        /// Access key for authentication
228        pub const DYN_KVBM_OBJECT_ACCESS_KEY: &str = "DYN_KVBM_OBJECT_ACCESS_KEY";
229
230        /// Secret key for authentication
231        pub const DYN_KVBM_OBJECT_SECRET_KEY: &str = "DYN_KVBM_OBJECT_SECRET_KEY";
232
233        /// Number of blocks to store in object storage
234        pub const DYN_KVBM_OBJECT_NUM_BLOCKS: &str = "DYN_KVBM_OBJECT_NUM_BLOCKS";
235    }
236    /// Transfer configuration
237    pub mod transfer {
238        /// Maximum number of blocks per transfer batch
239        pub const DYN_KVBM_TRANSFER_BATCH_SIZE: &str = "DYN_KVBM_TRANSFER_BATCH_SIZE";
240    }
241
242    /// KVBM leader (distributed mode) configuration
243    pub mod leader {
244        /// Timeout in seconds for KVBM leader and worker initialization
245        pub const DYN_KVBM_LEADER_WORKER_INIT_TIMEOUT_SECS: &str =
246            "DYN_KVBM_LEADER_WORKER_INIT_TIMEOUT_SECS";
247
248        /// ZMQ host for KVBM leader
249        pub const DYN_KVBM_LEADER_ZMQ_HOST: &str = "DYN_KVBM_LEADER_ZMQ_HOST";
250
251        /// ZMQ publish port for KVBM leader
252        pub const DYN_KVBM_LEADER_ZMQ_PUB_PORT: &str = "DYN_KVBM_LEADER_ZMQ_PUB_PORT";
253
254        /// ZMQ acknowledgment port for KVBM leader
255        pub const DYN_KVBM_LEADER_ZMQ_ACK_PORT: &str = "DYN_KVBM_LEADER_ZMQ_ACK_PORT";
256    }
257
258    /// NIXL backend configuration
259    pub mod nixl {
260        /// Prefix for NIXL backend environment variables
261        /// Pattern: DYN_KVBM_NIXL_BACKEND_<backend>=true/false
262        /// Example: DYN_KVBM_NIXL_BACKEND_UCX=true
263        pub const PREFIX: &str = "DYN_KVBM_NIXL_BACKEND_";
264    }
265}
266
267/// LLM (Language Model) inference environment variables
268pub mod llm {
269    /// HTTP body size limit in MB
270    pub const DYN_HTTP_BODY_LIMIT_MB: &str = "DYN_HTTP_BODY_LIMIT_MB";
271
272    pub const DYN_HTTP_GRACEFUL_SHUTDOWN_TIMEOUT_SECS: &str =
273        "DYN_HTTP_GRACEFUL_SHUTDOWN_TIMEOUT_SECS";
274
275    /// Enable LoRA adapter support (set to "true" to enable)
276    pub const DYN_LORA_ENABLED: &str = "DYN_LORA_ENABLED";
277
278    /// LoRA cache directory path
279    pub const DYN_LORA_PATH: &str = "DYN_LORA_PATH";
280
281    /// Enable the experimental Anthropic Messages API endpoint (/v1/messages)
282    pub const DYN_ENABLE_ANTHROPIC_API: &str = "DYN_ENABLE_ANTHROPIC_API";
283
284    /// Strip the Claude Code billing preamble (`x-anthropic-billing-header: ...`)
285    /// from the system prompt before forwarding to the target model. The preamble
286    /// varies per session and per release, wasting tokens and breaking prompt caching.
287    pub const DYN_STRIP_ANTHROPIC_PREAMBLE: &str = "DYN_STRIP_ANTHROPIC_PREAMBLE";
288
289    /// Enable streaming tool call dispatch (`event: tool_call_dispatch` SSE events)
290    pub const DYN_ENABLE_STREAMING_TOOL_DISPATCH: &str = "DYN_ENABLE_STREAMING_TOOL_DISPATCH";
291
292    /// Enable streaming reasoning dispatch (`event: reasoning_dispatch` SSE events)
293    pub const DYN_ENABLE_STREAMING_REASONING_DISPATCH: &str =
294        "DYN_ENABLE_STREAMING_REASONING_DISPATCH";
295
296    /// Backend stream inactivity timeout in seconds.
297    ///
298    /// When set to a positive integer, the frontend will kill the engine context
299    /// and drop the inflight guard if no SSE event is received from the backend
300    /// within this many seconds. Acts as a circuit breaker for zombie workers
301    /// that hold a live TCP connection but never produce output.
302    ///
303    /// Set to `0` or leave unset to disable the timeout (default: disabled).
304    pub const DYN_HTTP_BACKEND_STREAM_TIMEOUT_SECS: &str = "DYN_HTTP_BACKEND_STREAM_TIMEOUT_SECS";
305
306    /// Metrics configuration
307    pub mod metrics {
308        /// Custom metrics prefix (overrides default "dynamo_frontend")
309        pub const DYN_METRICS_PREFIX: &str = "DYN_METRICS_PREFIX";
310
311        /// Histogram bucket configuration (pattern: <PREFIX>_MIN, <PREFIX>_MAX, <PREFIX>_COUNT)
312        /// Example: DYN_HISTOGRAM_TTFT_MIN, DYN_HISTOGRAM_TTFT_MAX, DYN_HISTOGRAM_TTFT_COUNT
313        pub const HISTOGRAM_PREFIX: &str = "DYN_HISTOGRAM_";
314    }
315}
316
317/// Model loading and caching environment variables
318pub mod model {
319    /// Model Express configuration
320    pub mod model_express {
321        /// Model Express server endpoint URL
322        pub const MODEL_EXPRESS_URL: &str = "MODEL_EXPRESS_URL";
323
324        /// Model Express cache path
325        pub const MODEL_EXPRESS_CACHE_PATH: &str = "MODEL_EXPRESS_CACHE_PATH";
326    }
327
328    /// Hugging Face configuration
329    pub mod huggingface {
330        /// Hugging Face authentication token
331        pub const HF_TOKEN: &str = "HF_TOKEN";
332
333        /// Hugging Face Hub cache directory
334        pub const HF_HUB_CACHE: &str = "HF_HUB_CACHE";
335
336        /// Hugging Face home directory
337        pub const HF_HOME: &str = "HF_HOME";
338
339        /// Offline mode - skip API calls when model is cached
340        /// Set to "1" or "true" to enable
341        pub const HF_HUB_OFFLINE: &str = "HF_HUB_OFFLINE";
342    }
343}
344
345/// KV Router configuration environment variables
346pub mod router {
347    /// Queue threshold fraction for prefill token capacity.
348    /// When set, requests are queued if all workers exceed this fraction of max_num_batched_tokens.
349    pub const DYN_ROUTER_QUEUE_THRESHOLD: &str = "DYN_ROUTER_QUEUE_THRESHOLD";
350
351    /// Scheduling policy for the router queue ("fcfs" or "wspt").
352    pub const DYN_ROUTER_QUEUE_POLICY: &str = "DYN_ROUTER_QUEUE_POLICY";
353}
354
355/// TCP response stream server (CallHome listener) environment variables
356pub mod tcp_response_stream {
357    /// Port for the TCP response stream server.
358    /// If unset or 0, the OS assigns a free ephemeral port.
359    pub const DYN_TCP_RESPONSE_STREAM_PORT: &str = "DYN_TCP_RESPONSE_STREAM_PORT";
360
361    /// Host/interface for the TCP response stream server.
362    /// If unset, the server auto-detects a routable local IP.
363    pub const DYN_TCP_RESPONSE_STREAM_HOST: &str = "DYN_TCP_RESPONSE_STREAM_HOST";
364}
365
366/// Event Plane transport environment variables
367pub mod event_plane {
368    /// Event transport selection: "zmq" or "nats".
369    ///
370    /// When unset the default depends on the discovery backend:
371    /// - `file` / `mem` backends: defaults to `zmq` (no external services required).
372    /// - `etcd` / `kubernetes` backends: defaults to `nats`.
373    ///
374    /// Set this explicitly to override the context-aware default.
375    pub const DYN_EVENT_PLANE: &str = "DYN_EVENT_PLANE";
376
377    /// Event plane codec selection: "json" or "msgpack".
378    pub const DYN_EVENT_PLANE_CODEC: &str = "DYN_EVENT_PLANE_CODEC";
379}
380
381/// ZMQ Broker environment variables
382pub mod zmq_broker {
383    /// Explicit ZMQ broker URL (takes precedence over discovery)
384    /// Format: "xsub=<url1>[;<url2>...] , xpub=<url1>[;<url2>...]"
385    /// Example: "xsub=tcp://broker:5555 , xpub=tcp://broker:5556"
386    pub const DYN_ZMQ_BROKER_URL: &str = "DYN_ZMQ_BROKER_URL";
387
388    /// Enable ZMQ broker discovery mode
389    pub const DYN_ZMQ_BROKER_ENABLED: &str = "DYN_ZMQ_BROKER_ENABLED";
390
391    /// XSUB bind address (broker binary only)
392    pub const ZMQ_BROKER_XSUB_BIND: &str = "ZMQ_BROKER_XSUB_BIND";
393
394    /// XPUB bind address (broker binary only)
395    pub const ZMQ_BROKER_XPUB_BIND: &str = "ZMQ_BROKER_XPUB_BIND";
396
397    /// Namespace for broker discovery registration
398    pub const ZMQ_BROKER_NAMESPACE: &str = "ZMQ_BROKER_NAMESPACE";
399}
400
401/// Discovery environment variables
402pub mod discovery {
403    /// Discovery backend: "kubernetes" or "etcd" (default)
404    pub const DYN_DISCOVERY_BACKEND: &str = "DYN_DISCOVERY_BACKEND";
405
406    /// Kube discovery mode: "pod" (default) or "container" (each container registers independently)
407    pub const DYN_KUBE_DISCOVERY_MODE: &str = "DYN_KUBE_DISCOVERY_MODE";
408}
409
410/// CUDA and GPU environment variables
411pub mod cuda {
412    /// Path to custom CUDA fatbin file.
413    ///
414    /// Note: build.rs files cannot import this constant at build time,
415    /// so they must define local constants with the same value.
416    pub const DYN_FATBIN_PATH: &str = "DYN_FATBIN_PATH";
417}
418
419/// Build-time environment variables
420pub mod build {
421    /// Cargo output directory for build artifacts
422    ///
423    /// Note: This constant cannot be used with the `env!()` macro,
424    /// which requires a string literal at compile time.
425    /// Build scripts (build.rs) also cannot import this constant.
426    pub const OUT_DIR: &str = "OUT_DIR";
427}
428
429/// Mocker (mock scheduler/KV manager) environment variables
430pub mod mocker {
431    /// Enable structured KV cache allocation/eviction trace logs (set to "1" or "true" to enable)
432    pub const DYN_MOCKER_KV_CACHE_TRACE: &str = "DYN_MOCKER_KV_CACHE_TRACE";
433
434    /// Use the original direct() code path in the mocker request dispatch.
435    ///
436    /// This path is race-prone during startup; prefer leaving it unset unless you are
437    /// explicitly trying to reproduce the original behavior.
438    pub const DYN_MOCKER_SYNC_DIRECT: &str = "DYN_MOCKER_SYNC_DIRECT";
439}
440
441/// Testing environment variables
442pub mod testing {
443    /// Enable queued-up request processing in tests
444    pub const DYN_QUEUED_UP_PROCESSING: &str = "DYN_QUEUED_UP_PROCESSING";
445
446    /// Soak test run duration (e.g., "3s", "5m")
447    pub const DYN_SOAK_RUN_DURATION: &str = "DYN_SOAK_RUN_DURATION";
448
449    /// Soak test batch load size
450    pub const DYN_SOAK_BATCH_LOAD: &str = "DYN_SOAK_BATCH_LOAD";
451}
452
453#[cfg(test)]
454mod tests {
455    use super::*;
456
457    #[test]
458    fn test_no_duplicate_env_var_names() {
459        use std::collections::HashSet;
460
461        let mut seen = HashSet::new();
462        let vars = [
463            // Logging
464            logging::DYN_LOG,
465            logging::DYN_LOGGING_CONFIG_PATH,
466            logging::DYN_LOGGING_JSONL,
467            logging::DYN_SDK_DISABLE_ANSI_LOGGING,
468            logging::DYN_LOG_USE_LOCAL_TZ,
469            logging::DYN_LOGGING_SPAN_EVENTS,
470            logging::otlp::OTEL_EXPORT_ENABLED,
471            logging::otlp::OTEL_EXPORTER_OTLP_TRACES_ENDPOINT,
472            logging::otlp::OTEL_SERVICE_NAME,
473            logging::otlp::OTEL_EXPORTER_OTLP_LOGS_ENDPOINT,
474            // Runtime
475            runtime::DYN_RUNTIME_NUM_WORKER_THREADS,
476            runtime::DYN_RUNTIME_MAX_BLOCKING_THREADS,
477            runtime::system::DYN_SYSTEM_ENABLED,
478            runtime::system::DYN_SYSTEM_HOST,
479            runtime::system::DYN_SYSTEM_PORT,
480            runtime::system::DYN_SYSTEM_USE_ENDPOINT_HEALTH_STATUS,
481            runtime::system::DYN_SYSTEM_STARTING_HEALTH_STATUS,
482            runtime::system::DYN_SYSTEM_HEALTH_PATH,
483            runtime::system::DYN_SYSTEM_LIVE_PATH,
484            runtime::canary::DYN_CANARY_WAIT_TIME,
485            // Worker
486            worker::DYN_WORKER_GRACEFUL_SHUTDOWN_TIMEOUT,
487            // NATS
488            nats::NATS_SERVER,
489            nats::auth::NATS_AUTH_USERNAME,
490            nats::auth::NATS_AUTH_PASSWORD,
491            nats::auth::NATS_AUTH_TOKEN,
492            nats::auth::NATS_AUTH_NKEY,
493            nats::auth::NATS_AUTH_CREDENTIALS_FILE,
494            nats::stream::DYN_NATS_STREAM_MAX_AGE,
495            // ETCD
496            etcd::ETCD_ENDPOINTS,
497            etcd::auth::ETCD_AUTH_USERNAME,
498            etcd::auth::ETCD_AUTH_PASSWORD,
499            etcd::auth::ETCD_AUTH_CA,
500            etcd::auth::ETCD_AUTH_CLIENT_CERT,
501            etcd::auth::ETCD_AUTH_CLIENT_KEY,
502            // KVBM
503            kvbm::DYN_KVBM_METRICS,
504            kvbm::DYN_KVBM_METRICS_PORT,
505            kvbm::DYN_KVBM_ENABLE_RECORD,
506            kvbm::DYN_KVBM_DISABLE_DISK_OFFLOAD_FILTER,
507            kvbm::cpu_cache::DYN_KVBM_CPU_CACHE_GB,
508            kvbm::cpu_cache::DYN_KVBM_CPU_CACHE_OVERRIDE_NUM_BLOCKS,
509            kvbm::disk_cache::DYN_KVBM_DISK_CACHE_GB,
510            kvbm::disk_cache::DYN_KVBM_DISK_CACHE_OVERRIDE_NUM_BLOCKS,
511            kvbm::leader::DYN_KVBM_LEADER_WORKER_INIT_TIMEOUT_SECS,
512            kvbm::leader::DYN_KVBM_LEADER_ZMQ_HOST,
513            kvbm::leader::DYN_KVBM_LEADER_ZMQ_PUB_PORT,
514            kvbm::leader::DYN_KVBM_LEADER_ZMQ_ACK_PORT,
515            // LLM
516            llm::DYN_HTTP_BODY_LIMIT_MB,
517            llm::DYN_HTTP_BACKEND_STREAM_TIMEOUT_SECS,
518            llm::DYN_LORA_ENABLED,
519            llm::DYN_LORA_PATH,
520            llm::DYN_ENABLE_ANTHROPIC_API,
521            llm::DYN_STRIP_ANTHROPIC_PREAMBLE,
522            llm::DYN_ENABLE_STREAMING_TOOL_DISPATCH,
523            llm::DYN_ENABLE_STREAMING_REASONING_DISPATCH,
524            llm::metrics::DYN_METRICS_PREFIX,
525            // Model
526            model::model_express::MODEL_EXPRESS_URL,
527            model::model_express::MODEL_EXPRESS_CACHE_PATH,
528            model::huggingface::HF_TOKEN,
529            model::huggingface::HF_HUB_CACHE,
530            model::huggingface::HF_HOME,
531            model::huggingface::HF_HUB_OFFLINE,
532            // Router
533            router::DYN_ROUTER_QUEUE_THRESHOLD,
534            router::DYN_ROUTER_QUEUE_POLICY,
535            // TCP Response Stream
536            tcp_response_stream::DYN_TCP_RESPONSE_STREAM_PORT,
537            tcp_response_stream::DYN_TCP_RESPONSE_STREAM_HOST,
538            // Event Plane
539            event_plane::DYN_EVENT_PLANE,
540            event_plane::DYN_EVENT_PLANE_CODEC,
541            // ZMQ Broker
542            zmq_broker::DYN_ZMQ_BROKER_URL,
543            zmq_broker::DYN_ZMQ_BROKER_ENABLED,
544            zmq_broker::ZMQ_BROKER_XSUB_BIND,
545            zmq_broker::ZMQ_BROKER_XPUB_BIND,
546            zmq_broker::ZMQ_BROKER_NAMESPACE,
547            // Discovery
548            discovery::DYN_DISCOVERY_BACKEND,
549            discovery::DYN_KUBE_DISCOVERY_MODE,
550            // CUDA
551            cuda::DYN_FATBIN_PATH,
552            // Build
553            build::OUT_DIR,
554            // Mocker
555            mocker::DYN_MOCKER_KV_CACHE_TRACE,
556            mocker::DYN_MOCKER_SYNC_DIRECT,
557            // Testing
558            testing::DYN_QUEUED_UP_PROCESSING,
559            testing::DYN_SOAK_RUN_DURATION,
560            testing::DYN_SOAK_BATCH_LOAD,
561        ];
562
563        for var in &vars {
564            if !seen.insert(var) {
565                panic!("Duplicate environment variable name: {}", var);
566            }
567        }
568    }
569
570    #[test]
571    fn test_naming_conventions() {
572        // Dynamo-specific vars should start with DYN_
573        assert!(runtime::DYN_RUNTIME_NUM_WORKER_THREADS.starts_with("DYN_"));
574        assert!(runtime::system::DYN_SYSTEM_ENABLED.starts_with("DYN_"));
575        assert!(kvbm::DYN_KVBM_METRICS.starts_with("DYN_"));
576        assert!(worker::DYN_WORKER_GRACEFUL_SHUTDOWN_TIMEOUT.starts_with("DYN_"));
577
578        // NATS vars should start with NATS_
579        assert!(nats::NATS_SERVER.starts_with("NATS_"));
580        assert!(nats::auth::NATS_AUTH_USERNAME.starts_with("NATS_AUTH_"));
581
582        // ETCD vars should start with ETCD_
583        assert!(etcd::ETCD_ENDPOINTS.starts_with("ETCD_"));
584        assert!(etcd::auth::ETCD_AUTH_USERNAME.starts_with("ETCD_AUTH_"));
585
586        // OpenTelemetry vars should start with OTEL_
587        assert!(logging::otlp::OTEL_EXPORT_ENABLED.starts_with("OTEL_"));
588        assert!(logging::otlp::OTEL_SERVICE_NAME.starts_with("OTEL_"));
589    }
590}