config

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: May 8, 2021 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ProviderSet = wire.NewSet(New)

ProviderSet is a provider set for wire

Functions

func New

func New(path string) (*viper.Viper, error)

New serve caller to create a viper.Viper

Types

type APP

type APP struct {
	Name      string `json:"name" yaml:"name"`
	Signature string `json:"signature" yaml:"signature"`
}

APP declare information of application

type Config

type Config struct {
	APP  *APP  `json:"app" yaml:"app"`
	HTTP *HTTP `json:"http" yaml:"http"`
	DB   *DB   `json:"db" yaml:"db"`
	Log  *Log  `json:"log" yaml:"log"`
}

Config declare configuration for application

func (*Config) String

func (c *Config) String() string

type DB

type DB struct {
	URL   string `json:"url" yaml:"url"`
	Debug bool   `json:"debug" yaml:"debug"`
}

DB declare database configuration

type HTTP

type HTTP struct {
	Host string `json:"host" yaml:"host"`
	Port int    `json:"port" yaml:"port"`
	Mode string `json:"mode" yaml:"mode"`
}

HTTP declare http configuration

func (*HTTP) GetAddress

func (h *HTTP) GetAddress() string

GetAddress serve caller to get combine host and port, format is `host:port`

type Log

type Log struct {
	Level string `json:"level" yaml:"level"`
}

Log declare log configuration

Jump to

Keyboard shortcuts

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