config

package
v1.1.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ProviderSet = wire.NewSet(NewConfig)

ProviderSet is a provider set for wire

Functions

This section is empty.

Types

type API added in v1.0.1

type API struct {
	EndPoint string `json:"endPoint" yaml:"endPoint"`
}

API declare endpoint configuration

type APP

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

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"`
	API  *API  `json:"api" yaml:"api"`
}

Config declare configuration for application

func NewConfig

func NewConfig(path string) (*Config, error)

NewConfig serve caller to create a Config with config file path

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 {
	Format string `json:"format" yaml:"format"`
	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