package xos

import "git.sr.ht/~jamesponddotco/xstd-go/xos"

Package xos provides extensions for Go's standard os package.

Index

Functions

func GetBoolEnv

func GetBoolEnv(key string, fallback bool) bool

GetBoolEnv returns the boolean value of the environment variable named by the key.

If the variable is present in the environment the value (which may be empty) or if the variable is unset, a fallback value is returned.

func GetDurationEnv

func GetDurationEnv(key string, fallback time.Duration) time.Duration

GetDurationEnv returns the time.Duration value of the environment variable named by the key.

If the variable is present in the environment the value (which may be empty) or if the variable is unset, a fallback value is returned.

func GetEnv

func GetEnv(key, fallback string) string

GetEnv returns the string value of the environment variable named by the key.

If the variable is present in the environment the value (which may be empty) or if the variable is unset, a fallback value is returned.

func GetIntEnv

func GetIntEnv(key string, fallback int) int

GetIntEnv returns the integer value of the environment variable named by the key.

If the variable is present in the environment the value (which may be empty) or if the variable is unset, a fallback value is returned.

Source Files

env.go xos.go

Version
v0.13.1 (latest)
Published
Jan 29, 2025
Platform
linux/amd64
Imports
3 packages
Last checked
4 days ago

Tools for package owners.