env_provider

package
v0.0.0-...-a78f517 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package env implements a koanf.Provider that reads environment variables as conf maps.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NumberKeysMapToSlice

func NumberKeysMapToSlice(input interface{}) interface{}

NumberKeysMapToSlice converts a map with all keys as numbers to a slice recursively.

Example:

{ "a": { "0": 1, "1": 2 } } => { "a": [1, 2] }

func Unflatten

func Unflatten(mp map[string]interface{}) map[string]interface{}

Unflatten unflattens a map[string]interface{} to a nested map.

Types

type Env

type Env struct {
	// contains filtered or unexported fields
}

Env implements an environment variables provider.

func Provider

func Provider(prefix string, envPathMap map[string]string) *Env

Provider returns an environment variables provider that reads environment variables with the given prefix.

func (*Env) Read

func (e *Env) Read() (map[string]interface{}, error)

Read reads all available environment variables into a key:value map and returns it.

func (*Env) ReadBytes

func (e *Env) ReadBytes() ([]byte, error)

ReadBytes is not supported by the env provider.

Jump to

Keyboard shortcuts

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