config

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetEnv

func GetEnv(key string) string

func GetEnvBool

func GetEnvBool(key string, defaultValue bool) bool

GetEnvBool returns an environment variable as bool with a default value

func GetEnvDuration

func GetEnvDuration(key string, defaultValue time.Duration) time.Duration

GetEnvDuration returns an environment variable as time.Duration with a default value

func GetEnvFloat

func GetEnvFloat(key string, defaultValue float64) float64

GetEnvFloat returns an environment variable as float64 with a default value

func GetEnvInt

func GetEnvInt(key string, defaultValue int) int

GetEnvInt returns an environment variable as int with a default value

func GetEnvOrDefault

func GetEnvOrDefault(key, defaultValue string) string

func IsValidAlphabetic added in v1.1.0

func IsValidAlphabetic(str string) bool

IsValidAlphabetic checks if a string contains only alphabetic characters

func IsValidAlphanumeric added in v1.1.0

func IsValidAlphanumeric(str string) bool

IsValidAlphanumeric checks if a string contains only alphanumeric characters

func IsValidBase64

func IsValidBase64(base64Str string) bool

IsValidBase64 checks if a string is valid base64

func IsValidDomain

func IsValidDomain(domain string) bool

IsValidDomain checks if a string is a valid domain name

func IsValidEmail

func IsValidEmail(email string) bool

func IsValidFloat added in v1.1.0

func IsValidFloat(str string) bool

IsValidFloat checks if a string represents a valid float

func IsValidHex

func IsValidHex(hex string) bool

IsValidHex checks if a string contains only hexadecimal characters

func IsValidHost

func IsValidHost(host string) bool

IsValidHost checks if a string is a valid hostname or IP

func IsValidIP

func IsValidIP(ip string) bool

IsValidIP checks if a string is a valid IP address

func IsValidIPv4

func IsValidIPv4(ip string) bool

IsValidIPv4 checks if a string is a valid IPv4 address

func IsValidIPv6

func IsValidIPv6(ip string) bool

IsValidIPv6 checks if a string is a valid IPv6 address

func IsValidInteger added in v1.1.0

func IsValidInteger(str string) bool

IsValidInteger checks if a string represents a valid integer

func IsValidLowercase added in v1.1.0

func IsValidLowercase(str string) bool

IsValidLowercase checks if a string contains only lowercase characters

func IsValidNonEmptyString added in v1.1.0

func IsValidNonEmptyString(str string) bool

IsValidNonEmptyString checks if a string is not empty and not just whitespace

func IsValidNonNegativeFloat added in v1.1.0

func IsValidNonNegativeFloat(str string) bool

IsValidNonNegativeFloat checks if a string represents a valid non-negative float

func IsValidNonNegativeInteger added in v1.1.0

func IsValidNonNegativeInteger(str string) bool

IsValidNonNegativeInteger checks if a string represents a valid non-negative integer

func IsValidNumber added in v1.1.0

func IsValidNumber(str string) bool

IsValidNumber checks if a string represents a valid number

func IsValidNumeric added in v1.1.0

func IsValidNumeric(str string) bool

IsValidNumeric checks if a string contains only numeric characters

func IsValidPort

func IsValidPort(port string) bool

func IsValidPositiveFloat added in v1.1.0

func IsValidPositiveFloat(str string) bool

IsValidPositiveFloat checks if a string represents a valid positive float

func IsValidPositiveInteger added in v1.1.0

func IsValidPositiveInteger(str string) bool

IsValidPositiveInteger checks if a string represents a valid positive integer

func IsValidSlug

func IsValidSlug(slug string) bool

IsValidSlug checks if a string is a valid URL slug

func IsValidURL

func IsValidURL(urlStr string) bool

func IsValidUUID

func IsValidUUID(uuid string) bool

IsValidUUID checks if a string is a valid UUID

func IsValidUppercase added in v1.1.0

func IsValidUppercase(str string) bool

IsValidUppercase checks if a string contains only uppercase characters

func LoadYAMLConfig added in v1.2.0

func LoadYAMLConfig(filename string, target interface{}) error

LoadYAMLConfig loads and parses a YAML config file with environment variable substitution

func RequiredEnv

func RequiredEnv(key string) string

RequiredEnv returns an environment variable or panics if not set

func SubstituteEnvVars added in v1.2.0

func SubstituteEnvVars(content []byte) []byte

SubstituteEnvVars replaces ${VARIABLE} patterns with environment variable values Supports ${VARIABLE}, ${VARIABLE:-default}, and ${VARIABLE=default} syntax Both :- and = use the default value if the variable is unset or empty

Types

This section is empty.

Jump to

Keyboard shortcuts

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