config

package
v1.6.0-rc4 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get(key, def string) string

Get returns the value of the environment variable `key` if set. If not set, and `key + "_FILE"` is set, the file at that path is read and its trimmed contents are returned. If neither are set, def is returned.

func GetBool

func GetBool(key string, def bool) bool

GetBool returns the boolean value of the environment variable `key`. Recognised true values are: 1, t, true, y, yes (case-insensitive). Recognised false values are: 0, f, false, n, no.

func GetDuration added in v1.4.1

func GetDuration(key string, def time.Duration) time.Duration

GetDuration returns the duration value of the environment variable `key`. It uses ParseDuration and falls back to def if parsing fails or the variable is unset.

func GetInt

func GetInt(key string, def int) int

GetInt returns the integer value of the environment variable `key`. It parses the result of Get(key, ""). If parsing fails or the variable is unset, def is returned.

func ParseDuration added in v1.4.1

func ParseDuration(s string) (time.Duration, error)

ParseDuration parses a duration string. It behaves like time.ParseDuration but also supports values like "30d" to represent days.

Types

This section is empty.

Jump to

Keyboard shortcuts

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