config

package
v0.0.0-...-9c09179 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsInitialized

func IsInitialized() bool

IsInitialized ...

func MustInt

func MustInt(v string, def int) int

MustInt ...

func MustString

func MustString(v, def string) string

MustString ...

Types

type Configure

type Configure struct {
	Initialized bool     `toml:"initialized"`
	WebToken    WebToken `toml:"web_token"`
	Database    Database `toml:"database"`
	Redis       Redis    `toml:"redis"`
	Service     Service  `toml:"service"`
}

Configure ...

func Config

func Config() *Configure

Config ...

func DefaultConfig

func DefaultConfig() *Configure

DefaultConfig ...

func InitConfig

func InitConfig(path string) *Configure

InitConfig ...

func (*Configure) ParseDefault

func (cfg *Configure) ParseDefault(def *Configure) *Configure

ParseDefault ...

type Database

type Database struct {
	ShowSQL  bool   `toml:"show_sql"`
	UseCache bool   `json:"use_cache"`
	Type     string `toml:"type"`
	Addr     string `toml:"addr"`
	Port     string `toml:"port"`
	Username string `toml:"username"`
	Password string `toml:"password"`
	Schema   string `toml:"schema"`
	Location string `toml:"location"`
	Charset  string `toml:"charset"`
	Prefix   string `toml:"prefix"`
}

Database ...

func (*Database) Source

func (d *Database) Source() string

Source ...

type HTTP

type HTTP struct {
	Enable bool   `toml:"enable"`
	Type   string `toml:"type"`
	Path   string `toml:"path"`
	Port   string `toml:"port"`
}

HTTP ...

type Redis

type Redis struct {
	Addr     string `toml:"addr"`
	Password string `toml:"password"`
	DB       int    `toml:"db"`
}

Redis ...

type Service

type Service struct {
	EnableHTTP bool   `toml:"enable_http"`
	HostPort   string `toml:"host_port"`
	Type       string `toml:"type"`
}

Service ...

type WebToken

type WebToken struct {
	Key string `toml:"key"`
}

WebToken ...

Jump to

Keyboard shortcuts

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