config

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2023 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Load

func Load(configFilePath string, target any, dotenvFiles ...string) (exists bool, err error)

Load the configuration into the target from a yaml file and environment variables.

The boolean returned is true if the config file has been found, false otherwise.

It will look for dotenv files in the current directory. If no dotenvFiles are given, default ones will be used: .env and .env.local. target can implement the Processable interface to do any stuff after the config has been loaded.

func Save

func Save(configFilePath string, data any) error

Save the given config data in the given file path.

Types

type Processable

type Processable interface {
	PostLoad() error
}

Processable is an interface that can be implemented by the target of the Load function to do any stuff after a config has been loaded.

Jump to

Keyboard shortcuts

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