cli-config

command
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: May 28, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package main demonstrates using go-codex for CLI tool configuration: loading a TOML config file and overlaying environment variable overrides.

Pattern:

  1. Define AppConfig and configCodec once — the single source of truth for field names, types, validations, and documentation.
  2. Decode the config file through the codec (catches all file errors upfront).
  3. Apply environment variable overrides to the decoded struct.
  4. Re-validate the final struct (catches bad env values with the same constraints).

Run with: go run ./examples/cli-config

Jump to

Keyboard shortcuts

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