config

package
v0.0.0-...-1d90857 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SupportedExts = []string{"json", "yml", "yaml", "toml"}

SupportedExts are universally supported extensions.

Functions

func AddConfigPath

func AddConfigPath(in string)

AddConfigPath into lookup path list

func Get

func Get() interface{}

Get return your config

func Initialize

func Initialize(configFile string, cfgStructPtr interface{}) error

Initialize your config

func Reset

func Reset()

Reset Intended for testing, will reset all to default settings. In the public interface for the viper package so applications can use it in their testing as well.

Types

type AppENV

type AppENV string

AppENV ...

const (
	// Development ...
	Development AppENV = "development"
	// GlobalDevelopment ...
	GlobalDevelopment AppENV = "g-development"
	// Staging ...
	Staging AppENV = "staging"
	// Production ...
	Production AppENV = "production"
	// GlobalProduction ...
	GlobalProduction AppENV = "g-production"
	// K8s ...
	K8s AppENV = "k8s"
)

type Configer

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

Configer config manager

func Loader

func Loader() *Configer

func New

func New() *Configer

New return config manager

func (*Configer) AddPath

func (c *Configer) AddPath(in string)

AddPath into lookup path list

func (*Configer) SetDebug

func (c *Configer) SetDebug(debug bool)

type FileNotFoundError

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

FileNotFoundError denotes failing to find configuration file.

func (FileNotFoundError) Error

func (e FileNotFoundError) Error() string

Error returns the formatted configuration error.

type InvalidConfigTypeError

type InvalidConfigTypeError string

InvalidConfigTypeError denotes an invalid configuration type

func (InvalidConfigTypeError) Error

func (str InvalidConfigTypeError) Error() string

Error returns the formatted configuration error.

type ParseError

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

ParseError denotes failing to parse configuration file.

func (ParseError) Error

func (pe ParseError) Error() string

Error returns the formatted configuration error.

type UnsupportedConfigError

type UnsupportedConfigError string

UnsupportedConfigError denotes encountering an unsupported configuration file type.

func (UnsupportedConfigError) Error

func (str UnsupportedConfigError) Error() string

Error returns the formatted configuration error.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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