palyra.toml file. It supports automatic migrations, secret redaction, and runtime mutation through both the CLI and the web console.
Root Configuration Schema
The configuration is anchored by theRootFileConfig struct, which maps the TOML file structure into strongly-typed Rust modules.
| Section | Description | Key Code Entity |
|---|---|---|
daemon | Basic networking (bind address, port). | FileDaemonConfig |
gateway | gRPC and QUIC transport settings, TLS, and identity. | FileGatewayConfig |
model_provider | LLM backend settings (OpenAI, API keys, timeouts). | FileModelProviderConfig |
memory | Vector memory retention and auto-injection policies. | FileMemoryConfig |
tool_call | Sandboxing tiers and execution limits for plugins. | FileToolCallConfig |
vault_ref | References to secrets stored in the platform vault. | VaultRef |
Configuration Loading Pipeline
The daemon loads configuration by searching standard paths (e.g.,./palyra.toml, ~/.config/palyra/palyra.toml). The process involves parsing, migrating old versions to the current schema, and merging file values with system defaults.
Loading Logic Flow
Theload_config function in palyra-daemon orchestrates the transformation from a raw TOML file to a LoadedConfig object used by the runtime.
Config Loading Sequence
Sources: crates/palyra-daemon/src/config/load.rs#29-56, crates/palyra-common/src/config_system.rs#89-129
Secret Redaction and Safety
Palyra implements a “Secure by Default” approach to configuration display. Sensitive keys are never printed to logs or CLI output unless explicitly requested.Redaction Mechanisms
- Path-Based Redaction: Specific TOML paths (e.g.,
admin.auth_token) are hardcoded inSECRET_CONFIG_PATHSfor redaction. - Marker-Based Redaction: Any key containing substrings like
api_key,secret, ortokenis automatically redacted during general JSON/TOML tree processing. - Vault References: Instead of storing raw strings, configuration can use
vault_refvalues (e.g.,vault://global/openai_api_key), which instructs the daemon to fetch the value from the secureVaultat runtime.
Runtime Mutation via CLI
Thepalyra CLI provides a sub-command tree for manipulating palyra.toml without manual text editing. It uses the config_system.rs utilities to perform atomic updates and maintain backups.
CLI Config Commands
palyra config get --key <PATH>: Retrieves a value. Redacts secrets unless--show-secretsis passed.palyra config set --key <PATH> --value <TOML_LITERAL>: Updates or creates a key.palyra config unset --key <PATH>: Removes a configuration entry.
Mutation Logic
When a value is set, the system:- Parses the existing file into a
toml::Valuetable. - Creates a backup (e.g.,
palyra.toml.bak.1) using a rotation strategy. - Traverses the table to the target path, creating intermediate tables if necessary.
- Serializes the result back to disk, preserving file permissions (e.g.,
0o600for private configs).
Data Flow: File to Code Entities
This diagram illustrates how a TOML entry is transformed into a functional runtime configuration within thepalyrad process.
Config Entity Mapping
Sources: crates/palyra-common/src/daemon_config_schema.rs#64-81, crates/palyra-daemon/src/config/schema.rs#87-105, crates/palyra-daemon/src/model_provider.rs#123-140
Implementation Details
Key Functions and Constants
CONFIG_VERSION_V1: The current supported configuration schema version (currently1). crates/palyra-common/src/config_system.rs#14redact_secret_config_values: Iterates throughSECRET_CONFIG_PATHSand replaces values with<redacted>. crates/palyra-common/src/daemon_config_schema.rs#22-26set_value_at_path: A recursive table navigator that allows setting values using dot-notation strings (e.g.,gateway.tls.enabled). crates/palyra-common/src/config_system.rs#174-204DEFAULT_CONFIG_BACKUP_ROTATION: Defaults to keeping5previous versions of the configuration file during mutations. crates/palyra-common/src/config_system.rs#15
Config Permissions (Unix)
On Unix systems, the configuration system explicitly preserves the file mode. If apalyra.toml is set to 0o600 (owner read/write only), the set_value_at_path logic ensures the new file written after mutation retains these restricted permissions.
Sources: crates/palyra-cli/tests/config_mutation.rs#107-146, crates/palyra-common/src/config_system.rs#8-10