config

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2022 License: MIT Imports: 4 Imported by: 1

Documentation

Overview

Package config provides configuration loader based on env vars.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultLoaders added in v0.0.4

func DefaultLoaders(prefix string) []func() error

DefaultLoaders populate ENV vars from .env files.

func Load

func Load(prefix string, spec interface{}, loaders ...func() error) error

Load loads config from ENV vars, loaders are called to populate ENV vars in advance.

In no loaders are provided then vars from .env.template, .env, .env.<ENVIRONMENT> files are loaded if available. Use nil or any other source to avoid that.

func WithEnvFiles

func WithEnvFiles(files ...string) func() error

WithEnvFiles populates env vars from provided files.

It returns an error if file does not exist.

func WithOptionalEnvFiles

func WithOptionalEnvFiles(files ...string) func() error

WithOptionalEnvFiles populates env vars from provided files that exist.

Non-existent files are ignored.

Types

This section is empty.

Jump to

Keyboard shortcuts

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