Skip to main content

Crate enact_config

Crate enact_config 

Source
Expand description

Enact Configuration Management

Unified configuration management for Enact with:

  • Environment variable support for secrets (checks ENACT_* env vars first)
  • OS keychain for secrets (API keys, tokens, credentials) with fallback support
  • Encrypted file storage for settings (feature flags, timeouts, preferences)
  • Cloud sync for authenticated users (respects air-gapped mode)

§Example

use enact_config::{ConfigManager, RuntimeMode, default_config_path};

let config_path = default_config_path()?;
let manager = ConfigManager::new(config_path).await?;

// Load configuration
let config = manager.load().await?;

// Set a secret (stored in keychain)
manager.set_secret("providers.azure.apiKey", "your-api-key").await?;

// Set a setting (stored in encrypted file)
let mut config = manager.load().await?;
config.runtime.mode = RuntimeMode::Local;
manager.save(&config).await?;

// Save configuration
manager.save(&config).await?;

Re-exports§

pub use agent_def::AgentDef;
pub use agent_def::AgentRegistry;
pub use agent_def::ChannelBotConfig;
pub use doctor::run_checks;
pub use doctor::Check;
pub use doctor::CheckStatus;
pub use doctor::DoctorReport;
pub use encrypted_store::default_config_path;
pub use encrypted_store::EncryptedStore;
pub use home::create_config_backup;
pub use home::enact_home;
pub use home::ensure_home_dirs;
pub use home::load_dotenv_from_home;
pub use home::load_enact_md_context;
pub use home::resolve_config_file;
pub use home::write_env_secret;
pub use home::write_yaml_at_home;
pub use hook_config::HookConfig;
pub use hook_config::HookDecision;
pub use hook_config::HookEvent;
pub use hook_config::HookHandler;
pub use hook_config::HooksConfig;
pub use medic::disallowed_top_level_keys;
pub use medic::reference_yaml;
pub use medic::REFERENCE_FILES;
pub use project_def::ProjectDef;
pub use project_def::ProjectRegistry;
pub use project_def::Task;
pub use project_def::TaskBoard;
pub use secrets::SecretManager;
pub use sync::SyncManager;
pub use sync::SyncStatus;
pub use config::*;

Modules§

agent_def
Agent definitions — one YAML file per agent under ENACT_HOME/agents//agent.yaml
config
Configuration Types - Core configuration structure
doctor
Configuration health check — validates ENACT_HOME structure, YAML files, and provider readiness. Used by enact doctor, pre-commit hook, and gateway startup.
encrypted_store
Encrypted File Storage - Secure storage for non-sensitive settings
home
ENACT_HOME — single source of truth for the Enact data directory.
hook_config
Hook configuration — lifecycle event hooks (SessionStart, PreToolUse, etc.).
medic
Medic reference schemas — skeleton YAML files that define allowed structure for ENACT_HOME config. Used for boundary checks (no extra keys) and for enact doctor --fix (merge missing keys, reset).
project_def
Project definitions and taskboards — ENACT_HOME/projects//project.yaml and taskboard.yaml
secrets
Secrets Management - Environment variable based storage for secrets
sync
Cloud Sync - Automatic configuration synchronization

Structs§

ConfigManager
Main configuration manager