Skip to main content

Crate direnv_config

Crate direnv_config 

Source
Expand description

§direnv-config

Rust SDK for direnv-config (dc) — read and write YAML-backed directory configuration from Rust.

§Quick start

use direnv_config::{DcClient, DcClientOptions, DcMode};

let client = DcClient::new(None).expect("failed to discover dc store");

// Read a value
if let Some(host) = client.get_string("myapp", "db.host").unwrap() {
    println!("db host: {host}");
}

// Write a value to the local layer
client.set("myapp", "db.port", "5433", None, false).unwrap();

§Backends

The SDK provides two backends via DcMode:

  • Native (default) — reads and writes YAML files directly on the filesystem.
  • Cli — shells out to the dc binary for all operations.

See the repository README for full documentation on the direnv-config system.

Re-exports§

pub use client::DcClient;
pub use client::DcClientOptions;
pub use client::DcMode;
pub use client::Backend;
pub use meta::StoreMeta;

Modules§

client
merge
meta
path
resolve
store
version

Enums§

Value
Represents any valid YAML value.