config

package
v0.0.0-...-3f0a6de Latest Latest
Warning

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

Go to latest
Published: May 14, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetEnvConfPath

func GetEnvConfPath() string

GetEnvConfPath returns toml file path from environment variable `$GO-BOOK_CONF`

Types

type Logger

type Logger struct {
	Service      string `toml:"service" validate:"required"`
	Env          string `toml:"env" validate:"oneof=dev prod custom"`
	Level        string `toml:"level" validate:"required"`
	IsStackTrace bool   `toml:"is_stacktrace"`
}

Logger is zap logger property

type MySQL

type MySQL struct {
	IsEnabled  bool   `toml:"is_enabled"`
	Host       string `toml:"host"`
	Port       uint16 `toml:"port"`
	DBName     string `toml:"dbname"`
	User       string `toml:"user"`
	Pass       string `toml:"pass"`
	IsDebugLog bool   `toml:"is_debug_log"`
}

MySQL is MySQL Server property

type Root

type Root struct {
	Server *Server `toml:"server" validate:"required"`
	Logger *Logger `toml:"logger" validate:"required"`
	MySQL  *MySQL  `toml:"mysql"`
}

Root is root config

func NewConfig

func NewConfig(fileName string) (*Root, error)

NewConfig returns *Root config

type Server

type Server struct {
	Port       int                   `toml:"port" validate:"required"`
	HTTPMethod httpmethod.HTTPMethod `toml:"http_method" validate:"oneof=GET POST"`
}

Server is server information

Jump to

Keyboard shortcuts

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