Skip to main content

Module config

Module config 

Source
Expand description

Configuration gear for toolkit-bootstrap

This gear provides configuration types and utilities for both host and OoP gears.

Structs§

AppConfig
Main application configuration with strongly-typed global sections and a flexible per-gear configuration bag.
CliArgs
Command line arguments structure.
DbConnConfig
Reusable DB connection config for both global servers and gears. DSN must be a FULL, valid DSN if provided (dsn crate compliant).
ExecutionConfig
Execution configuration for out-of-process gears.
GearConfig
Small typed view to parse each gear entry.
GearRuntime
Runtime configuration for a gear (local vs out-of-process).
GlobalDatabaseConfig
Global database configuration with server-based DBs.
PoolCfg
RenderedDbConfig
Rendered database configuration for OoP gears. Contains both global server templates and gear-specific config.
RenderedGearConfig
Rendered gear configuration passed to OoP gears via environment variable.
Section
SectionFile
ServerConfig

Enums§

ConsoleFormat
Console output format for the logging layer.
RuntimeKind
Gear runtime kind.
VendorConfigError
Error type for vendor configuration access.

Constants§

TOOLKIT_MODULE_CONFIG_ENV
Environment variable name for passing rendered gear config to OoP gears.

Functions§

build_final_db_for_gear
Merges global + gear DB configs into a final, validated DSN and pool config. Precedence: Global DSN -> Global fields -> Gear DSN -> Gear fields (fields always win). For server-based, returns error if final dbname is missing. For SQLite, builds/normalizes sqlite DSN from file/path or uses a full DSN as-is.
default_logging_config
Create a default logging configuration.
dump_effective_gears_config_json
Dump effective gears configuration as JSON string.
dump_effective_gears_config_yaml
Dump effective gears configuration as YAML string.
expand_env_in_dsn
Expands environment variables in a DSN string. Replaces ${VARNAME} with the actual environment variable value.
gear_home
Helper function to resolve gear home directory. Returns the path where gear-specific files (like SQLite databases) should be stored.
get_gear_db_config
Helper function to get gear database configuration from AppConfig. Returns the DbConnConfig for a gear, or None if the gear has no database config.
get_gear_runtime_config
Helper to get runtime config for a gear (if present).
list_gear_names
List all gear names present in the configuration.
parse_gear_config
Parse a gear config from the config bag.
redact_dsn_password
Redacts password from a DSN for safe logging.
render_effective_gears_config
Render effective configuration for all loaded gears.
render_gear_config_for_oop
Render gear configuration for passing to OoP gear via environment variable.
resolve_password
Resolves password: if it contains ${VAR}, expands from environment variable; otherwise returns as-is.
validate_dsn
Validates that a DSN string is parseable by the dsn crate. Note: SQLite DSNs have special formats that dsn crate doesn’t recognize, so we skip validation for them.

Type Aliases§

LoggingConfig
Logging configuration - maps subsystem names to their logging settings. Key “default” is the catch-all for logs that don’t match explicit subsystems.
VendorConfig
Per-vendor configuration bag: vendor name → arbitrary JSON/YAML value. Each vendor’s section can be deserialized into a typed struct via AppConfig::vendor_config or AppConfig::vendor_config_or_default.