configx

package
v0.0.0-...-afa1935 Latest Latest
Warning

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

Go to latest
Published: May 8, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Vip        = viper.New()
	ConfigFile = ""
	// ServerSetting global config
	ServerSetting = new(YamlSetting)
)

Functions

func InitConfig

func InitConfig()

InitConfig reads in config file and ENV variables if set.

Types

type DingTalkBot

type DingTalkBot struct {
	WebHookUrl  string   `yaml:"webHookUrl"`
	AccessToken string   `yaml:"accessToken"`
	SignToken   string   `yaml:"signToken"`
	AtUserIds   []string `yaml:"atUserIds"`
	AtMobiles   []string `yaml:"atMobiles"`
	IsAtAll     bool     `yaml:"isAtAll"`
}

DingTalkBot notify

type Email

type Email struct {
	Subject  string   `yaml:"subject"`
	Host     string   `yaml:"host"`
	Port     int      `yaml:"port"`
	Form     string   `yaml:"from"`
	Password string   `yaml:"password"`
	To       []string `yaml:"to"`
}

Email notify

type Log

type Log struct {
	AppName       string `yaml:"appName"`
	Development   bool   `yaml:"development"`
	Level         string `yaml:"level"`
	LogFileDir    string `yaml:"logFileDir"`
	InfoFileName  string `yaml:"infoFileName"`
	WarnFileName  string `yaml:"warnFileName"`
	ErrorFileName string `yaml:"errorFileName"`
	DebugFileName string `yaml:"debugFileName"`
	MaxAge        int    `yaml:"maxAge"`
	MaxBackups    int    `yaml:"maxBackups"`
	MaxSize       int    `yaml:"maxSize"`
}

Log log parameters

type Notify

type Notify struct {
	IsEnable    bool        `yaml:"isEnable"`
	NotifyType  string      `yaml:"notifyType"`
	Email       Email       `yaml:"email"`
	Wechat      Wechat      `yaml:"wechat"`
	WechatBot   WechatBot   `yaml:"wechatbot"`
	DingTalkBot DingTalkBot `yaml:"dingtalkbot"`
}

Notify send massage notify

type Sftp

type Sftp struct {
	Hostname string `yaml:"hostname"`
	SshPort  int    `yaml:"sshPort"`
	Username string `yaml:"username"`
	Password string `yaml:"password"`
}

Sftp sftp server host

type Sync

type Sync struct {
	Name       string `yaml:"name"`
	SourcePath string `yaml:"sourcePath"`
	TargetPath string `yaml:"targetPath"`
}

Sync sync path parameters

type Wechat

type Wechat struct {
	AccessTokenUrl string `yaml:"accessTokenUrl"`
	SendUrl        string `yaml:"sendUrl"`
	CorpId         string `yaml:"corpId"`
	CorpSecret     string `yaml:"corpSecret"`
	ToUser         string `yaml:"toUser"`
	AgentId        int    `yaml:"agentId"`
}

Wechat notify

type WechatBot

type WechatBot struct {
	WebHookUrl          string   `yaml:"webHookUrl"`
	Key                 string   `yaml:"key"`
	MentionedList       []string `yaml:"mentionedList"`
	MentionedMobileList []string `yaml:"mentionedMobileList"`
}

WechatBot notify

type YamlSetting

type YamlSetting struct {
	Sftp        Sftp     `yaml:"sftp"`
	Sync        []Sync   `yaml:"sync"`
	IgnoreFiles []string `yaml:"ignoreFiles"`
	Log         Log      `yaml:"log"`
	Notify      Notify   `yaml:"notify"`
}

YamlSetting global constants are defined and configured by the user according to the file conf.yaml in conf

func GetConfig

func GetConfig(vip *viper.Viper) *YamlSetting

GetConfig 解析配置文件,反序列化

Jump to

Keyboard shortcuts

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