Procyon|Docs
Configuration

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

  1. Command-line options are added first.
  2. Environment variables are added as another property source.
  3. resources/procyon.yml and profile files are loaded.
  4. Values are resolved by property name.
  5. Configuration can be bound into typed Go structs.
resources/procyon.yml
server:
  port: 8080

database:
  host: localhost
  port: 5432
server_properties.go
type ServerProperties struct {
    Port int `property:"port,default=8080"`
}

The binder reads values below the server prefix and fills the struct using the property tags.

main.go
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.