environmentflags

package
v1.1.45 Latest Latest
Warning

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

Go to latest
Published: May 30, 2024 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddFlag

func AddFlag(flags *pflag.FlagSet)

AddFlag adds the magic flag that enables the environment variable parsing feature. See SetFlagsFromEnvironment for more information.

func SetFlagsFromEnvironment

func SetFlagsFromEnvironment(flags *pflag.FlagSet) []error

SetFlagsFromEnvironment is enabled/configured by a user setting the magic flag in `flagsFromEnvironmentPrefixFlag`. If set, this function looks for the value of each *other* flag in the environment, and updates the given flags as if any found values we passed on the command line.

For example, if the magic flag was set to "PARAM_", and the flags contained a flag named "foo-bar", this function would look for a variable named "PARAM_FOO_BAR". There is some type coercion borrowed from the Cobra CLI framework, so if "foo-bar" was a boolean flag, it could be set with "PARAM_FOO_BAR=true", "PARAM_FOO_BAR=1", and so on.

This function can't help set positional arguments, it only helps with flags.

This function largely exists so that tools like ArgoCD that want to run Thelma with configuration in the environment can do so without needing a wrapper script.

Types

This section is empty.

Jump to

Keyboard shortcuts

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