Skip to main content

direnv_config/
lib.rs

1//! # direnv-config
2//!
3//! Rust SDK for [direnv-config (dc)](https://github.com/noizu/direnv-config) —
4//! read and write YAML-backed directory configuration from Rust.
5//!
6//! ## Quick start
7//!
8//! ```rust,no_run
9//! use direnv_config::{DcClient, DcClientOptions, DcMode};
10//!
11//! let client = DcClient::new(None).expect("failed to discover dc store");
12//!
13//! // Read a value
14//! if let Some(host) = client.get_string("myapp", "db.host").unwrap() {
15//!     println!("db host: {host}");
16//! }
17//!
18//! // Write a value to the local layer
19//! client.set("myapp", "db.port", "5433", None, false).unwrap();
20//! ```
21//!
22//! ## Backends
23//!
24//! The SDK provides two backends via [`DcMode`]:
25//!
26//! - **Native** (default) — reads and writes YAML files directly on the filesystem.
27//! - **Cli** — shells out to the `dc` binary for all operations.
28//!
29//! See the [repository README](https://github.com/noizu/direnv-config) for full
30//! documentation on the direnv-config system.
31
32pub mod store;
33pub mod version;
34pub mod path;
35pub mod merge;
36pub mod resolve;
37pub mod meta;
38pub mod client;
39
40// Re-export primary public types
41pub use client::{DcClient, DcClientOptions, DcMode, Backend};
42pub use meta::StoreMeta;
43pub use serde_yaml::Value;