config

package
v0.0.0-...-828062d Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2018 License: MIT Imports: 7 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	CurrentConfig  *AppConfig
	CurrentBaseDir string
)

Functions

func CheckAllowIP

func CheckAllowIP(ip string) bool

检测IP是否被允许访问

func GetAppList

func GetAppList() map[string]*AppInfo

func SetBaseDir

func SetBaseDir(baseDir string)

Types

type AppConfig

type AppConfig struct {
	XMLName    xml.Name    `xml:"config"`
	Log        Log         `xml:"log"`
	Apps       []AppInfo   `xml:"apps>app"`
	HttpServer *HttpServer `xml:"httpserver"`
	AllowIps   []string    `xml:"allowips>ip"`
	SyncNode   *SyncNode   `xml:"syncnode"`
}

配置信息

func InitConfig

func InitConfig(configFile string) *AppConfig

初始化配置文件

type AppInfo

type AppInfo struct {
	AppID   string `xml:"appid,attr"`
	AppName string `xml:"appname,attr"`
	//域名
	Domain     string `xml:"domain,attr"`
	MessageApi string `xml:"messageapi,attr"`
	//鉴权Api
	AuthApi string `xml:"authapi,attr"`
	TimeOut int64  `xml:"timeout,attr"`
}

app配置

func GetAppInfo

func GetAppInfo(appId string) (*AppInfo, bool)

type HttpServer

type HttpServer struct {
	HttpPort    int    `xml:"httpport,attr"`
	PProfPort   int    `xml:"pprofport,attr"`
	IsTLS       bool   `xml:"istls,attr"`
	TLSCertFile string `xml:"tlscertfile,attr"`
	TLSKeyFile  string `xml:"tlskeyfile,attr"`
}

全局配置

type InfluxdbInfo

type InfluxdbInfo struct {
	ID       string `xml:"id,attr"`
	ServerIP string `xml:"serverip,attr"`
	UserName string `xml:"username,attr"`
	Password string `xml:"password,attr"`
	DBName   string `xml:"dbname,attr"`
}

Influxdb信息

type Log

type Log struct {
	FilePath string `xml:"filepath,attr"`
}

log配置

type SyncNode

type SyncNode struct {
	InfluxdbInfo *InfluxdbInfo `xml:"influxdb"`
}

Jump to

Keyboard shortcuts

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