basic

command
v0.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 1, 2025 License: MIT Imports: 8 Imported by: 0

README

Basic Example

Demonstrates core Rigging features:

  • Multi-source loading (YAML + env vars)
  • Struct tag validation
  • Custom validators
  • Secret redaction
  • Provenance tracking

Run

go run main.go

# Override with environment variables
export APP_DATABASE__PASSWORD=secret
export APP_ENVIRONMENT=production
go run main.go

Key Points

Struct Tags:

type Config struct {
    Port     int    `conf:"default:8080,min:1024"`
    Password string `conf:"required,secret"`
}

Environment Variables: Use __ for nesting

  • APP_DATABASE__HOSTDatabase.Host
  • APP_SERVER__PORTServer.Port
  • Prefix matching is case-insensitive by default (APP_, app_, App_ all match)
  • Set CaseSensitive: true in sourceenv.Options for exact matching

YAML Keys: Match struct fields (lowercase)

database:
  host: localhost
  port: 5432

See main README for full documentation.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL