env

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: May 16, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package env provides typed environment variable helpers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Duration added in v0.0.12

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

Duration reads key as a time.Duration. It expects Go duration syntax such as "500ms", "5s", or "2h".

func Get

func Get[T convutil.Scalar](key string, fallback T) T

Get reads key and converts it into T. It returns fallback when key is unset or conversion fails.

func IsDev

func IsDev() bool

IsDev returns true if GO_ENV, APP_ENV, or ENV is "development" or "dev".

func IsProd

func IsProd() bool

IsProd returns true if GO_ENV, APP_ENV, or ENV is "production" or "prod".

func IsSet

func IsSet(key string) bool

IsSet returns true when key is present, even if its value is empty.

func Must added in v0.0.12

func Must(key string) string

Must returns key's raw value, panicking when key is unset or empty.

func Slice added in v0.0.12

func Slice(key, separator string, fallback []string) []string

Slice reads key, splits it by separator, trims whitespace, and removes empty values. It returns fallback when key is unset or empty.

func Value added in v0.0.12

func Value(key string) string

Value returns the raw value of key, or an empty string when key is not set.

Types

This section is empty.

Jump to

Keyboard shortcuts

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