local

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ENV

func ENV() string

ENV return environment

func Load

func Load(config interface{}, files ...string) error

Load will unmarshal configurations to struct from files that you provide

Types

type Config

type Config struct {
	Environment        string
	ENVPrefix          string
	Debug              bool
	Verbose            bool
	Silent             bool
	AutoReload         bool
	AutoReloadInterval time.Duration
	AutoReloadCallback func(config interface{})

	// In case of json files, this field will be used only when compiled with
	// go 1.10 or later.
	// This field will be ignored when compiled with go versions lower than 1.10.
	ErrorOnUnmatchedKeys bool
}

type Configor

type Configor struct {
	*Config
	// contains filtered or unexported fields
}

func New

func New(config *Config) *Configor

New initialize a Configor

func (*Configor) GetEnvironment

func (configor *Configor) GetEnvironment() string

GetEnvironment get environment

func (*Configor) Handle

func (configor *Configor) Handle(handle func([]byte), files ...string) (err error)

Load will unmarshal configurations to struct from files that you provide

func (*Configor) Load

func (configor *Configor) Load(config interface{}, files ...string) (err error)

Load will unmarshal configurations to struct from files that you provide

Jump to

Keyboard shortcuts

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