Crate secretspec_derive

Crate secretspec_derive 

Source
Expand description

§SecretSpec Derive Macros

This crate provides procedural macros for the SecretSpec library, enabling compile-time generation of strongly-typed secret structs from secretspec.toml configuration files.

§Overview

The macro system reads your secretspec.toml at compile time and generates:

  • A SecretSpec struct with all secrets as fields (union of all profiles)
  • A SecretSpecProfile enum with profile-specific structs
  • A Profile enum representing available profiles
  • Type-safe loading methods with automatic validation

§Key Features

  • Compile-time validation: Invalid configurations are caught during compilation
  • Type safety: Secrets are accessed as struct fields, not strings
  • Profile awareness: Different types for different profiles (e.g., production vs development)
  • Builder pattern: Flexible configuration with method chaining
  • Environment integration: Automatic environment variable handling

Macros§

declare_secrets
Generates typed SecretSpec structs from your secretspec.toml file.