configure

package module
v0.0.0-...-0f7df96 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

README

config

一键配置导入库,具备监控热更新功能

Documentation

Index

Constants

View Source
const (
	Local = "local"
	Dev   = "dev"
	Test  = "test"
	Prod  = "prod"
)

run env

View Source
const (
	Yaml = "yaml"
	Json = "json"
	Xml  = "xml"
)

file type

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

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

func Load

func Load(file string, options ...Option) *Config

func (*Config) Env

func (c *Config) Env() string

func (*Config) Scan

func (c *Config) Scan(v any) error

type Option

type Option func(c *Config)

func WithEnvironment

func WithEnvironment(env string) Option

if ($env) { config.{env}(environment).yaml } else { config.env.yaml}

func WithFileChangeCallBack

func WithFileChangeCallBack(f func(config any, err error)) Option

func WithSearchPath

func WithSearchPath(path string) Option

Default current program directory

Jump to

Keyboard shortcuts

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