Using Configuration
Understand how Procyon collects configuration and makes it available to your application.
Configuration in Procyon is built around the application environment. It gives framework packages and application components one ordered place to read runtime settings from files, environment variables, command-line arguments, and custom property sources.
The goal is not just reading values. The useful part is binding those values into typed structs before components use them, so services can depend on normal Go values instead of parsing strings throughout the codebase.
How configuration flows
- Command-line options are added first.
- Environment variables are added as another property source.
resources/procyon.ymland profile files are loaded.- Values are resolved by property name.
- Configuration can be bound into typed Go structs.
server:
port: 8080
database:
host: localhost
port: 5432type ServerProperties struct {
Port int `property:"port,default=8080"`
}The binder reads values below the server prefix and fills the struct using the
property tags.
var props ServerProperties
binder := config.NewDefaultPropertyBinder(env.PropertySources())
if err := binder.Bind("server", &props); err != nil {
return err
}Where to go next
Start with files for project defaults, profiles for environment-specific overrides, runtime overrides for deployment values, and binding for component configuration. Use direct resolving only for small runtime decisions or framework-level integration code.
Configuration files
Create `resources/procyon.yml` and keep application defaults in one predictable place.
Profiles
Load profile-specific files for local, staging, production, or another runtime mode.
Runtime overrides
Override file values with command-line arguments and environment variables.
Property sources
Understand source ordering, names, origins, and map-backed configuration values.
Binding properties
Bind configuration into typed structs with defaults, optional fields, and nested values.
Resolving values
Read individual values or expand placeholders from the environment resolver.
