What problem does it solve?
Developers building MoonBit agents on Golem need a code-first way to declare, inject, and validate typed configuration and secrets instead of manually parsing raw environment values at runtime.
Core Features & Use Cases
- Typed Config Derivation: Annotate structs with
#derive.config to auto-generate schema collection and typed loading via ConfigField trait implementations.
- Constructor Injection: Add a
@config.Config[T] parameter to the agent's new function so the platform validates and loads all config at construction time.
- Secret Management: Wrap sensitive fields in
@config.Secret[T] so values are fetched dynamically per environment via get!() rather than cached at startup.
- Use Case: Define an
AppConfig struct with a nested DatabaseConfig containing a secret password, declare values in golem.yaml, and manage secrets with golem secret create CLI commands.
Quick Start
Add typed configuration to my MoonBit Golem agent with a nested database config and a secret password field.