config

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2022 License: Unlicense Imports: 6 Imported by: 0

README

Config

Populate a go struct based on values found in the environment. Takes an opinionated view of how environment variables should be named based on struct field naming.

Documentation

Overview

Package config implements utility routines for populating and managing configuration.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadFromEnvironment

func LoadFromEnvironment[T any, PtrT *T](pt PtrT, prefix string) error

Environment variable keys are determined by converting the key reference to upper snake case, splitting on any words or child references. eg.

FooBar.Baz -> FOO_BAR_BAZ

Basic data types can also be used by populating the prefix argument to match the exact corresponding environment variable key name.

func MustLoadFromEnvironment

func MustLoadFromEnvironment[T any, PtrT *T](pt PtrT, prefix string)

MustLoadFromEnvironment behaves the same as LoadFromEnvironment but will panic instead of returning any errors.

Types

This section is empty.

Jump to

Keyboard shortcuts

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