config

package
v0.0.0-...-4125756 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package config provides a simple logic that will read configuration from configmaps, io.Reader or envvar.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func From

func From(in io.Reader, i interface{}) error

From read from an io (file, byte buffer) and populates the specified struct based on the input and environment variables.

c := struct {
	Name string
	St   struct {
		Name string
		Port int
		List []string
	} `yaml:"astruct"`
}{}

func FromConfigMap

func FromConfigMap(i interface{}) error

FromConfigMap read a config from the path `./config.yaml`.

func LookupEnv

func LookupEnv(key, defaultValue string) string

LookupEnv retrieves the value of the environment variable named by the key. If the variable is present in the environment the value is returned. Otherwise, the returned value will the defaultValue.

Types

This section is empty.

Jump to

Keyboard shortcuts

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