config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2021 License: MIT Imports: 7 Imported by: 0

README

Config

  • env
  • file
  • etcd

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetEnvString

func GetEnvString(key string, defaultValue string) string

GetEnvString get value from env.

func Load

func Load(filename string, val interface{}) error

Load alias for config func.

func LoadWithType

func LoadWithType(filename string, cfgType string) (*viper.Viper, error)

LoadWithType load conf by file type.

Types

type Config

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

Config conf struct.

func New

func New(cfgDir string, opts ...Option) *Config

New create a config instance.

func (*Config) Load

func (c *Config) Load(filename string, val interface{}) error

Load scan data to struct.

func (*Config) LoadWithType

func (c *Config) LoadWithType(filename string, cfgType string) (v *viper.Viper, err error)

LoadWithType load conf by file type.

type Option

type Option func(*Config)

Option config option

func WithEnv

func WithEnv(name string) Option

WithEnv env var

func WithFileType

func WithFileType(fileType string) Option

WithFileType config file type

Jump to

Keyboard shortcuts

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