Skip to main content

config/
lib.rs

1// SPDX-License-Identifier: Apache-2.0
2//! Heddle user-config TOML schema, credential-file store, transport knobs,
3//! and tracing initialization.
4//!
5//! This crate contains configuration inputs and the durable global
6//! credential-store schema used by both the Heddle CLI and operator tooling.
7//! Transport implementations and application policy remain in their callers.
8
9pub mod client_config;
10pub mod config;
11pub mod credentials;
12pub mod logging;
13pub mod output;
14pub mod tls_trust;
15pub mod web_origin;
16
17pub fn heddle_home_override() -> Option<std::path::PathBuf> {
18    std::env::var_os("HEDDLE_HOME")
19        .filter(|path| !path.is_empty())
20        .map(std::path::PathBuf::from)
21}
22
23pub fn heddle_home_dir() -> std::path::PathBuf {
24    heddle_home_override().unwrap_or_else(|| {
25        std::env::var_os("HOME")
26            .map(std::path::PathBuf::from)
27            .unwrap_or_else(|| std::path::PathBuf::from("."))
28            .join(".heddle")
29    })
30}
31
32pub use client_config::{
33    ClientConfig, cleartext_connect_allowed, cleartext_refused_message, is_loopback_ip,
34};
35pub use config::UserConfig;
36pub use logging::{
37    LogFormat, LoggingConfig, LoggingGuard, init_logging, init_logging_default, is_enabled,
38};
39pub use output::OutputMode;
40pub use tls_trust::{
41    REMOTE_TLS_CA_CERT_SETTING, annotate_error_chain_tls_trust_failure, annotate_tls_trust_failure,
42    is_tls_trust_failure,
43};