envcompat

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: AGPL-3.0, AGPL-3.0-or-later Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package envcompat lets the process accept ZANA_* environment variables while every existing reader keeps looking at KORA_*.

ZANA_<S> is the preferred spelling of KORA_<S>. Promote copies each ZANA_<S> into KORA_<S> in the process environment before configuration is read, so no call site changes. The mapping is by prefix only: KORA_CLOUD_KORA_RELOAD_URL pairs with ZANA_CLOUD_KORA_RELOAD_URL.

An empty value counts as unset, matching how configuration readers treat it. If both spellings are set to different values, ZANA_* wins.

Nothing in this package ever logs or returns a variable's value.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Report

type Report struct {
	// Deprecated lists KORA_* variables in effect with no ZANA_* counterpart.
	Deprecated []string
	// Overridden lists ZANA_* variables whose value replaced a different
	// value of the KORA_* twin.
	Overridden []string
}

Report names the variables that need an operator's attention. It holds names only, never values.

func Apply

func Apply(log *slog.Logger) (Report, error)

Apply promotes ZANA_* variables in the real process environment and logs the resulting report to log. Call it first thing in main, before any configuration is read.

func Promote

func Promote(environ []string, setenv func(key, value string) error) (Report, error)

Promote copies ZANA_<S> to KORA_<S> through setenv for every ZANA_* entry in environ with a non-empty value, and reports deprecated and overridden names. Both slices in the Report are sorted.

func (Report) Log

func (r Report) Log(log *slog.Logger)

Log writes at most one line per kind of finding, naming variables only.

Jump to

Keyboard shortcuts

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