config

package
v0.0.0-...-594642b Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Setup

func Setup(path string)

载入配置文件

Types

type Application

type Application struct {
	ReadTimeout    int    `mapstructure:"read-timeout" json:"readTimeout" yaml:"read-timeout"`
	WriterTimeout  int    `mapstructure:"writer-timeout" json:"writerTimeout" yaml:"writer-timeout"`
	EncryptionCost int    `mapstructure:"encryption-cost" json:"encryptionCost" yaml:"encryption-cost"`
	Host           string `mapstructure:"host" json:"host" yaml:"host"`
	Port           string `mapstructure:"port" json:"port" yaml:"port"`
	Name           string `mapstructure:"name" json:"name" yaml:"name"`
	Mode           string `mapstructure:"mode" json:"mode" yaml:"mode"`
}

type Config

type Config struct {
	Application Application `mapstructure:"application" json:"application" yaml:"application"`
	Jwt         Jwt         `mapstructure:"jwt" json:"jwt" yaml:"jwt"`
	Database    Database    `mapstructure:"database" json:"database" yaml:"database"`
	Redis       Redis       `mapstructure:"redis" json:"redis" yaml:"redis"`
	Logger      Logger      `mapstructure:"logger" json:"logger" yaml:"logger"`
	SMS         SMS         `mapstructure:"sms" json:"sms" yaml:"sms"`
}
var (
	OSConfig *Config
)

type Database

type Database struct {
	Driver       string `mapstructure:"driver" json:"driver" yaml:"driver"`
	Source       string `mapstructure:"source" json:"source" yaml:"source"`
	MaxIdleConns int    `mapstructure:"max-idle-conns" json:"maxIdleConns" yaml:"max-idle-conns"`
	MaxOpenConns int    `mapstructure:"max-open-conns" json:"maxOpenConns" yaml:"max-open-conns"`
	MaxLifetime  int    `mapstructure:"max-life-time" json:"maxLifeTime" yaml:"max-life-time"`
}

type Jwt

type Jwt struct {
	Secret  string `mapstructure:"secret" json:"secret" yaml:"secret"`
	Timeout int64  `mapstructure:"timeout" json:"timeout" yaml:"timeout"`
}

type Logger

type Logger struct {
	Path       string `mapstructure:"path" json:"path" yaml:"path"`
	Level      int    `mapstructure:"level" json:"level" yaml:"level"`
	MaxSize    int    `mapstructure:"max-size" json:"maxSize" yaml:"max-size"`
	MaxBackups int    `mapstructure:"max-backups" json:"maxBackups" yaml:"max-backups"`
	MaxAge     int    `mapstructure:"max-age" json:"maxAge" yaml:"max-age"`
	Compress   bool   `mapstructure:"compress" json:"compress" yaml:"compress"`
	Stdout     bool   `mapstructure:"stdout" json:"stdout" yaml:"stdout"`
	EnabledBUS bool   `mapstructure:"enabledbus" json:"enabledbus" yaml:"enabledbus"`
	EnabledREQ bool   `mapstructure:"enabledreq" json:"enabledreq" yaml:"enabledreq"`
	EnabledDB  bool   `mapstructure:"enableddb" json:"enableddb" yaml:"enableddb"`
	EnabledJOB bool   `mapstructure:"enabledjob" json:"enabledjob" yaml:"enabledjob"`
}

type Redis

type Redis struct {
	Network  string `mapstructure:"network" json:"network" yaml:"network"`
	Addr     string `mapstructure:"addr" json:"addr" yaml:"addr"`
	Password string `mapstructure:"password" json:"password" yaml:"password"`
	DB       int    `mapstructure:"db" json:"db" yaml:"db"`
}

type SMS

type SMS struct {
	AccessKeyId  string `mapstructure:"access-key-id" json:"accessKeyId" yaml:"access-key-id"`
	AccessSecret string `mapstructure:"access-secret" json:"accessSecret" yaml:"access-secret"`
}

func (SMS) Marshal

func (s SMS) Marshal(code int) (param string, err error)

Jump to

Keyboard shortcuts

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