configtmpl

package
v0.4.8 Latest Latest
Warning

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

Go to latest
Published: May 12, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package configtmpl provides template functions for ue in config source templates.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Default

func Default(def, v any) any

Default returns the provided def value if v is either nil or the zero value for its type.

Example
def := "good bye"
v := "hello world"

fmt.Println(Default(def, v))
Output:

hello world
Example (Nil)
fmt.Println(Default("WORLD", nil))
Output:

WORLD
Example (Zero)
var v int
fmt.Println(Default(10, v))
Output:

10

func Env

func Env(key string) string

Env returns the environment variable value for the given key or an empty string, if the environment variable does not exist.

Example
os.Setenv("HELLO", "WORLD")
defer os.Unsetenv("HELLO")

fmt.Println(Env("HELLO"))
Output:

WORLD

Types

This section is empty.

Jump to

Keyboard shortcuts

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