envutil

package
v1.22.9 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: Apache-2.0 Imports: 2 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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DiscoverProviders

func DiscoverProviders(prefix, suffix string) []string

DiscoverProviders scans environment variables to find configured providers. It looks for environment variables matching the pattern: <prefix><PROVIDER_ID><suffix> For example, with prefix="SAML_PROVIDERS_" and suffix="_ENABLED", it will find "ENTRA_TMIDEV_SAML" from "SAML_PROVIDERS_ENTRA_TMIDEV_SAML_ENABLED=true"

func Get

func Get(key, fallback string) string

Get retrieves an environment variable with a fallback value. Returns the environment variable value if set and non-empty, otherwise returns the fallback.

func ProviderIDToKey

func ProviderIDToKey(providerID string) string

ProviderIDToKey converts an environment variable provider ID to a provider key. It converts to lowercase and replaces underscores with hyphens. For example: "ENTRA_TMIDEV_SAML" -> "entra-tmidev-saml"

func ScanPrefixedMap

func ScanPrefixedMap(prefix string) map[string]string

ScanPrefixedMap returns a map of every environment variable whose name starts with prefix, keyed by the lowercased remainder of the name and valued by the variable's value. For example, with prefix "OAUTH_PROVIDERS_GOOGLE_USERINFO_CLAIMS_":

OAUTH_PROVIDERS_GOOGLE_USERINFO_CLAIMS_SUBJECT_CLAIM=sub  -> {"subject_claim": "sub"}
OAUTH_PROVIDERS_GOOGLE_USERINFO_CLAIMS_EMAIL_CLAIM=email  -> {"email_claim": "email"}

Returns a non-nil empty map when nothing matches. Used for OAuth userinfo claim mappings and additional OAuth parameters, which are dynamic-cardinality (the concrete keys are only known at runtime).

Types

This section is empty.

Jump to

Keyboard shortcuts

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