sourceenv

package
v0.4.16 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package sourceenv loads configuration from environment variables.

Key normalization:

  • FOO__BAR -> foo.bar
  • FOO_BAR -> foo_bar
  • MY__SERVICE__API_KEY -> my.service.api_key

Example:

source := sourceenv.New(sourceenv.Options{Prefix: "APP_"})
loader := rigging.NewLoader[Config]().WithSource(source)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(opts Options) rigging.Source

New creates an environment variable source.

Types

type Options

type Options struct {
	// Prefix filters vars starting with prefix (stripped before normalization).
	// Empty = load all vars.
	// Prefix matching behavior is controlled by CaseSensitive.
	Prefix string

	// CaseSensitive controls prefix matching (default: false).
	// When false, prefix matching is case-insensitive (APP_ matches app_, App_, etc.).
	// When true, prefix must match exactly.
	// Keys are always normalized to lowercase after prefix stripping.
	CaseSensitive bool
}

Options configures environment variable source behavior.

Jump to

Keyboard shortcuts

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