config

package
v0.0.0-...-f463d71 Latest Latest
Warning

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

Go to latest
Published: May 31, 2021 License: AGPL-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 Database

type Database struct {
	Type     string `yaml:"type"`
	DBName   string `gorm:"dbname" yaml:"dbname"`
	Addr     string `gorm:"addr" yaml:"addr"`
	Port     string `gorm:"port" yaml:"port"`
	Username string `gorm:"username" yaml:"username"`
	Password string `gorm:"password" yaml:"password"`
}

type JWT

type JWT struct {
	Secret string `yaml:"secret"`
}

type LogConfig

type LogConfig struct {
	FilePath      string `json:"filepath" yaml:"filepath"`           // 日志文件
	Level         string `json:"level" yaml:"level" `                // 日志级别:debug,info,error
	MaxSize       int    `json:"maxsize" yaml:"maxsize"`             // 文件大小,单位M
	MaxBackups    int    `json:"maxbackups" yaml:"maxbackups" `      //  轮转文件个数
	MaxAge        int    `json:"maxage" yaml:"maxage" `              // 保留的文件最长时间
	LogType       string `json:"logtype" yaml:"logtype" `            // 输出的日志类型,支持json和txt(Console类型)
	Compress      bool   `json:"compress" yaml:"compress" `          // 文件是否压缩
	OutputConsole bool   `json:"outputconsole" yaml:"outputconsole"` // 输出到控制台或文件,true输出到控制台,false输出到文件
}

type MyConfig

type MyConfig struct {
	Service   Service   `yaml:"service"`
	LogConfig LogConfig `yaml:"logconfig"`
	Database  Database  `yaml:"database"`
	JWT       JWT       `yaml:"jwt"`
}

func InitConfig

func InitConfig() *MyConfig

func New

func New() *MyConfig

type Service

type Service struct {
	Host string `json:"host" ` //监听IP
	Port string `json:"port"`  // 监听端口
}

Service 服务监听ip与端口

Jump to

Keyboard shortcuts

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