config

package
v0.0.0-...-f67571d Latest Latest
Warning

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

Go to latest
Published: May 10, 2020 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	HTTPServer HTTPServer
	Logger     Logger
	Database   Database `mapstructure:"database"`
	Redis      Redis

	Version   string `yaml:"-"`
	BuildDate string `yaml:"-"`
}

Config struct to wrap config file

func Load

func Load(env string) (*Config, error)

Load loads the config file into Config struct

type Database

type Database struct {
	Master  string
	Replica string
}

Database configurations

type HTTPServer

type HTTPServer struct {
	ListenAddress   string
	Port            int
	GracefulTimeout time.Duration
	ReadTimeout     time.Duration
	WriteTimeout    time.Duration
	IdleTimeout     time.Duration
}

HTTPServer config for server setting

type Logger

type Logger struct {
	EnableConsole     bool
	ConsoleJSONFormat bool
	ConsoleLevel      string
	EnableFile        bool
	FileJSONFormat    bool
	FileLevel         string
	FileLocation      string
}

Logger logging setting

type Redis

type Redis struct {
	Endpoint    string
	Timeout     int
	ReadTimeout int
	MinIdle     int
	PoolSize    int
}

Redis configurations

Jump to

Keyboard shortcuts

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