utils

package
v0.15.1 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2025 License: Apache-2.0 Imports: 6 Imported by: 44

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetEnvDurationWithRange added in v0.15.0

func GetEnvDurationWithRange(envVar string, defaultValue, min, max time.Duration) (time.Duration, error)

GetEnvDurationWithRange returns the time.Duration value of the environment variable specified by `envVar`. If the environment variable is not set, it returns `defaultValue`. If the value is set but is not valid (not a valid time.Duration or falls outside the specified range [minValue, maxValue] inclusively), it returns `defaultValue` and an error.

func GetPEM

func GetPEM(val string) ([]byte, error)

GetPEM loads a PEM-encoded file (certificate or key).

func IsTruthy

func IsTruthy(val string) bool

IsTruthy returns true if a string is a truthy value. Truthy values are "y", "yes", "true", "t", "on", "1" (case-insensitive); everything else is false.

func IsValidPEM

func IsValidPEM(val string) bool

IsValidPEM validates the provided input has PEM formatted block.

func IsYaml

func IsYaml(fileName string) bool

IsYaml checks whether the file is yaml or not.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳