conf

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

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

Go to latest
Published: Mar 4, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ConfigError = errors.New("config is not found")
	DEFAULTENV  = "DEV"
)
View Source
var Conf = new(Config)

Functions

func ParseConfig

func ParseConfig(filepath string, object interface{}, env string) error

func ParseYaml

func ParseYaml(filepath string, out interface{}) error

func SetDefaultEnv

func SetDefaultEnv(env string)

Types

type Config

type Config struct {
	Etcd     EtcdConfig  `json:"etcd"`
	Database SqlConfig   `json:"database"`
	Redis    rds.Options `json:"redis"`
	Scheme   string      `json:"scheme"`
}

type EtcdConfig

type EtcdConfig struct {
	Endpoints   []string      `json:"endpoints"`
	DialTimeout time.Duration `json:"dial-timeout"`
	Scheme      string        `json:"scheme"`
}

type Md

type Md struct {
	NoAuth bool `yaml:"no_auth"`
}

type SqlConfig

type SqlConfig struct {
	Name     string `json:"name"`
	Host     string `json:"host"`
	Port     int    `json:"port"`
	Database string `json:"database"`
	Username string `json:"username"`
	Password string `json:"password"`
	Timeout  uint   `json:"timeout"`
	LogMode  bool   `json:"log_mode"`
}

type YamlConfig

type YamlConfig struct {
	Service string        `yaml:"service"`
	Version string        `yaml:"version"`
	Port    int           `yaml:"port"`
	Method  map[string]Md `yaml:"method"`
}

Jump to

Keyboard shortcuts

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