envconfig

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package envconfig resolves OPENSTORAGE_* settings. Presence, not a nonempty value, selects a name. The old CODESTORAGE_* names are not read: CheckLegacy refuses a process that still sets one without its replacement.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckLegacy added in v0.17.0

func CheckLegacy() error

CheckLegacy fails when a CODESTORAGE_* variable is set and its OPENSTORAGE_* replacement is unset. The error names every such pair, sorted, and never includes a value. A legacy name next to its set replacement is ignored, so a fleet that still runs pre-0.15 binaries can keep both names. Do not call this in hook subprocesses: git relays hook stderr to the pushing client.

func First

func First(names ...string) string

First returns the value of the first PRESENT name in an alias chain. An explicitly empty earlier name ends the scan instead of exposing a later alias.

func Getenv

func Getenv(name string) string

Getenv is the value-only form of LookupEnv, suitable for injected config readers.

func LookupEnv

func LookupEnv(name string) (string, bool)

LookupEnv is os.LookupEnv, kept as the injectable reader for settings. Lookups never log: hooks and lazy runtime settings read it on every call.

func Set

func Set(env []string, name, value string) []string

Set replaces both spellings with one trusted canonical value. Children read only OPENSTORAGE_* names: every hook script runs this binary (EnsureCacheRepo rewrites managed hooks before each request), and 0.15.x and 0.16.x hook binaries also read the canonical name first.

func Strip

func Strip(env []string, names ...string) []string

Strip removes both spellings of each canonical name from a child environment, so no inherited value under either prefix reaches the child. It reuses env's backing array; callers must own that slice.

Types

This section is empty.

Jump to

Keyboard shortcuts

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