config

package
v0.0.0-...-85547db Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GlobalConfig = &Config{
	Log: Log{
		DisableTimestamp: false,
		Level:            "info",
		Format:           "text",
		FileName:         "/var/log/lauriston-store/data.log",
		MaxSize:          20,
	},
	Server: Server{
		Host: "0.0.0.0",
		Port: 19091,
	},
	MySQL: MySQL{
		DSN:     "root:root@tcp(localhost:3306)/lauriston?charset=utf8mb4&parseTime=true&loc=Local",
		MinOpen: 5,
		MaxOpen: 10,
	},
	MongoDB: MongoDB{
		DSN:     "mongodb://localhost:27017",
		MaxOpen: 10,
	},
}

Functions

This section is empty.

Types

type Config

type Config struct {
	Log     Log     `json:"log" toml:"log"`
	Server  Server  `json:"server" toml:"server"`
	MySQL   MySQL   `json:"mysql" toml:"mysql"`
	MongoDB MongoDB `json:"mongodb" toml:"mongodb"`
}

func (*Config) Load

func (c *Config) Load(path string, override func(cfg *Config)) error

func (*Config) String

func (cg *Config) String() string

type Log

type Log struct {
	DisableTimestamp bool   `json:"disable-timestamp" toml:"disable-timestamp"`
	Level            string `json:"level" toml:"level"`
	Format           string `json:"format" toml:"format"`
	FileName         string `json:"filename" toml:"filename"`
	MaxSize          int    `json:"maxsize" toml:"maxsize"`
}

type MongoDB

type MongoDB struct {
	DSN     string `json:"dsn" toml:"dsn"`
	MaxOpen uint64 `json:"max-open" toml:"max-open"`
}

type MySQL

type MySQL struct {
	DSN     string `json:"dsn" toml:"dsn"`
	MinOpen int    `json:"min-open" toml:"min-open"`
	MaxOpen int    `json:"max-open" toml:"max-opne"`
}

type Server

type Server struct {
	Host string `json:"host" toml:"host"`
	Port int    `json:"port" toml:"port"`
}

Jump to

Keyboard shortcuts

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