config

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

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

Go to latest
Published: Jan 19, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadConfigInfo

func LoadConfigInfo(path string)

加载应用配置文件

Types

type App

type App struct {
	Name   string `mapstructure:"name"`
	Module string `mapstructure:"module"`
	Port   int    `mapstructure:"port"`
	Mode   string `mapstructure:"mode"`
}

应用

type Cache

type Cache struct {
	Host     string `mapstructure:"host"`
	Password string `mapstructure:"password"`
}

缓存

type Config

type Config struct {
	App      App               `mapstructure:"app"`
	Secret   Secret            `mapstructire:"secret"`
	Log      Log               `mapstructure:"log"`
	Database DBType            `mapstructure:"database"`
	Cache    Cache             `mapstructure:"cache"`
	Mq       Mq                `mapstructure:"mq"`
	Jwt      Jwt               `mapstructure:"jwt"`
	OSS      OSS               `mapstructure:"oss"`
	Email    Email             `mapstructure:"email"`
	Custom   map[string]string `mapstructure:"custom"`
}

配置项

var GLOBAL *Config

全局使用

type DBType

type DBType struct {
	Master Database `mapstructure:"master"`
	Slave  Database `mapstructure:"slave"`
}

type Database

type Database struct {
	Host     string `mapstructure:"host"`
	Port     int    `mapstructure:"port"`
	User     string `mapstructure:"user"`
	Password string `mapstructure:"password"`
	DB       string `mapstructure:"db"`
}

数据库

type Email

type Email struct {
	Smtp     string `mapstructure:"smtp"`
	Port     int    `mapstructure:"port"`
	Username string `mapstructure:"username"`
	Password string `mapstructure:"password"`
	Alias    string `mapstructure:"alias"`
}

邮件服务器配置

type Jwt

type Jwt struct {
	Key      string   `mapstructure:"key"`
	Expires  int64    `mapstructure:"expires"`
	Excludes []string `mapstructure:"excludes"`
}

JWT权限设置

type Log

type Log struct {
	File  string `mapstructure:"file"`
	Level string `mapstructure:"level"`
}

日志

type Mq

type Mq struct {
	Nsqd string `mapstructure:"nsqd"`
}

消息队列

type OSS

type OSS struct {
	Region  string `mapstructure:"region"`
	Id      string `mapstructure:"id"`
	Secret  string `mapstructure:"secret"`
	Arn     string `mapstructure:"arn"`
	Session string `mapstructure:"session"`
	Bucket  string `mapstructure:"bucket"`
	Domain  string `mapstructure:"domain"`
}

OSS配置

type Secret

type Secret struct {
	Key string `mapstructure:"key"`
}

安全

Jump to

Keyboard shortcuts

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