env

package
v0.8.7 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package env provides helpers for reading environment variables with defaults.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get(key, defaultValue string) string

Get returns the trimmed value of the environment variable named by key. If the variable is unset or empty after trimming, defaultValue is returned.

func GetBool

func GetBool(key string, defaultValue bool) bool

GetBool returns the boolean value of the environment variable named by key. Recognizes true/false, 1/0, t/f, yes/no (case-insensitive). If the variable is unset or unrecognized, defaultValue is returned.

func GetInt

func GetInt(key string, defaultValue int) int

GetInt returns the integer value of the environment variable named by key. If the variable is unset or unparsable, defaultValue is returned. Values like "50abc" are rejected (unlike fmt.Sscanf which parses the prefix).

Types

This section is empty.

Jump to

Keyboard shortcuts

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