docker_secrets 0.2.0

Returns Docker secrets in Rust
Documentation
# Docker Secrets

[![Crates.io](https://img.shields.io/crates/v/docker_secrets.svg)](https://crates.io/crates/docker_secrets)
[![Documentation](https://docs.rs/docker_secrets/badge.svg)](https://docs.rs/docker_secrets)
[![License](https://img.shields.io/crates/l/docker_secrets.svg)](https://github.com/alexgreencode/docker_secrets/blob/master/LICENSE)

A Rust library to easily access Docker secrets.

Docker secrets are mounted into the container at `/run/secrets`. This library provides a simple interface to read them.

## Installation

Add this to your `Cargo.toml`:

```toml
[dependencies]
docker_secrets = "0.2.0"
```

## Usage

### Get all secrets

Returns a list of secret names found in `/run/secrets`.

```rust
use docker_secrets::get_list;

fn main() {
    match get_list() {
        Ok(secrets) => {
            for secret in secrets {
                println!("Found secret: {}", secret);
            }
        }
        Err(e) => eprintln!("Error listing secrets: {}", e),
    }
}
```

### Get a specific secret

Reads the content of a specific secret.

```rust
use docker_secrets::get;

fn main() {
    match get("my_secret") {
        Ok(secret_value) => println!("Secret value: {}", secret_value),
        Err(e) => eprintln!("Error reading secret: {}", e),
    }
}
```

## Configuration

By default, the library looks for secrets in `/run/secrets`. You can override this path by setting the `DOCKER_SECRETS_DIR` environment variable. This is useful for local development and testing.

```bash
export DOCKER_SECRETS_DIR=./my_local_secrets
cargo run
```

## License

This project is licensed under either of

- Apache License, Version 2.0, ([LICENSE-APACHE]LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license ([LICENSE-MIT]LICENSE-MIT or http://opensource.org/licenses/MIT)

at your option.