mapstructenv

package module
v1.0.1 Latest Latest
Warning

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

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

README

Env. variable decode hook for mapstructure

Go Reference GitHub go.mod Go version Go Report Card

This simple package contains a handy decode hook made to be used with https://github.com/go-viper/mapstructure, that translates the environment variable references in the given configuration into the actual values from the referenced environment variable.

Documentation

Overview

Package mapstructenv provides a decode hook function that replaces the raw value with an environment variable value under the same key.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnvReplacerHookFunc

func EnvReplacerHookFunc() mapstructure.DecodeHookFuncType

EnvReplacerHookFunc returns a hook function that tries to replace the raw value with an environment variable value under the same key. An environment variable is a string that starts with "${" and ends with "}", e.g. "${SOME_CONFIGURATION_KEY}". If the environment variable does not exist, the raw value is returned.

Types

This section is empty.

Jump to

Keyboard shortcuts

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