conf

package
v1.3.4 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	APPName     = "XY.MessageCenter"
	ProjectName = "xymessagecenter"

	WebServerAddr      = ":27779"
	WebServerHttpsAddr = ":27799"
	// WebCertFileEnv 默认证书路径环境变量
	WebCertFileEnv = "MSG_WEB_CERT_FILE"
	WebKeyFileEnv  = "MSG_WEB_KEY_FILE"

	DDAPPKeyName    = "MSG_DD_APP_KEY"
	DDAppSecretName = "MSG_DD_APP_SECRET"

	// BaseSecretKeyName 项目基础密钥 (环境变量名)
	BaseSecretKeyName = "MSG_BASE_SECRET_KEY"
	// BaseSecretSalt 用于解密基础密钥值的密钥 (编译在程序中)
	BaseSecretSalt = "Fufu@msg.Demo"

	// ESBodySep ES 数据分隔符
	ESBodySep = "=-:-="

	// ESPostBatchNum ES 单次批量写入最大条数或最大字节数
	ESPostBatchNum   = 3000
	ESPOSTBatchBytes = 4 << 20

	// LogCacheTable Log 缓存表名, 时间格式化
	LogCacheTable = "LOG:15:04"
	// LogLimitDuration 繁忙的日志限制 (每秒最多 3 个日志)
	LogLimitDuration = time.Second
	LogLimitNum      = 3
	LogDataName      = "LOG_DATA"

	// WatcherInterval 文件变化监控时间间隔(分)
	WatcherInterval = 1

	// DDMediaFileType 钉钉默认文件类型, 默认大小限制: 10 MiB
	DDMediaFileType = ".doc|.docx|.xls|.xlsx|.ppt|.pptx|.zip|.pdf|.rar"
	DDMediaFileSize = "10MiB"

	// ReqTimeoutDuration 作为客户端发起请求默认超时时间(秒)
	ReqTimeoutDuration = 30 * time.Second
)

Variables

View Source
var (
	Debug     bool
	Version   = "v0.0.0"
	GoVersion = ""
	GitCommit = ""

	// RootPath 运行绝对路径
	RootPath = utils.ExecutableDir(true)

	// FilePath 配置文件绝对路径
	FilePath = filepath.Join(RootPath, "..", "etc")

	// ConfigFile 默认配置文件路径
	ConfigFile = filepath.Join(FilePath, ProjectName+".json")

	// LogDir 日志路径
	LogDir = filepath.Join(RootPath, "..", "log")

	// LogDaemon 守护日志
	LogDaemon = filepath.Join(LogDir, "daemon.log")

	// Config 所有配置
	Config tJSONConf

	// ReqUserAgent 请求名称
	ReqUserAgent = APPName + "/" + Version

	// FilesVer 配置文件版本信息
	FilesVer sync.Map
)

Functions

func InitConfig

func InitConfig()

InitConfig 初始化配置

func LoadConf

func LoadConf() error

LoadConf 加载配置

Types

type TFilesConf

type TFilesConf struct {
	Path            string `json:"path"`
	Method          string `json:"method"`
	SecretName      string `json:"secret_name"`
	API             string `json:"api"`
	Interval        int    `json:"interval"`
	SecretValue     string
	GetConfDuration time.Duration
}

func (*TFilesConf) GetMonitorSource

func (c *TFilesConf) GetMonitorSource() error

GetMonitorSource 获取监控平台源数据配置

type TFilesVer

type TFilesVer struct {
	MD5        string
	LastUpdate time.Time
}

func GetFilesVer

func GetFilesVer(k interface{}) (ver *TFilesVer)

GetFilesVer 获取或初始化文件版本信息

Jump to

Keyboard shortcuts

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