g

package
v0.0.0-...-3534724 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2023 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
View Source
const CREDENTIAL_KEY = "Credential"

Variables

View Source
var (
	// ConfigFile 配置文件
	ConfigFile string
)
View Source
var Engine *xorm.Engine

Engine 全局XORM的引擎

View Source
var (
	// GlobalStat 获取服务器当前系统环境的全局对象
	GlobalStat = statgo.NewStat()
)

Functions

func InitDB

func InitDB() (err error)

InitDB 初始化数据库连接

func InitLog

func InitLog()

func ParseConfig

func ParseConfig(cfg string)

ParseConfig 从配置文件读取配置,反序列化成配置对象

Types

type DatabaseConfig

type DatabaseConfig struct {
	Addr           string `json:"addr"`
	MaxIdle        int    `json:"max_idle"`
	MaxConnections int    `json:"max_connections"`
	WaitTimeout    int    `json:"wait_timeout"`
}

DatabaseConfig 数据库配置

type GlobalConfig

type GlobalConfig struct {
	Log      *LogConfig      `json:"log"`
	Cert     string          `json:"cert"`
	Key      string          `json:"key"`
	Database *DatabaseConfig `json:"database"`
	Backup   *DatabaseConfig `json:"backup"`
	Mail     *MailConfig     `json:"mail"`
	Listen   string          `json:"listen"`
	Secret   *SecretConfig   `json:"secret"`
}

GlobalConfig 配置

func Config

func Config() *GlobalConfig

Config 返回当前的配置

type JwtConfig

type JwtConfig struct {
	TokenName string `json:"token_name"` // "Authentication"
	Issuer    string `json:"issuer"`     // "db"
	SecretKey string `json:"secret_key"` // "362b36fd7d514c519333234da152eaff"
}

JwtConfig JWT配置

type LogConfig

type LogConfig struct {
	Level string `json:"level"`
}

LogConfig 日志配置

type MailConfig

type MailConfig struct {
	Enabled    bool   `json:"enabled"`
	Addr       string `json:"addr"`
	User       string `json:"user"`
	Password   string `json:"password"`
	Encryption string `json:"encryption"`
}

MailConfig 邮件发送配置

type SecretConfig

type SecretConfig struct {
	Jwt    *JwtConfig `json:"jwt"`
	Crypto string     `json:"crypto"`
}

SecretConfig 安全配置

type Template

type Template string

Template 邮件模板

const (
	TplTicketCreated    Template = "b5c5ac9c-2071-4dd3-af5c-69ec149ee682"
	TplTicketUpdated    Template = "5043d567-02ef-4f5e-be9a-13df9f5fde11"
	TplTicketRemoved    Template = "6e861f70-5d8c-4042-879c-9ca932fb792b"
	TplTicketExecuted   Template = "03714a3f-eafe-4836-8e85-d360ee29a70f"
	TplTicketFailed     Template = "0a55142a-e336-4a97-b655-94ecac454da2"
	TplTicketScheduled  Template = "0c7bf7ab-8e39-464e-b0b0-6a209842058a"
	TplTicketClosed     Template = "5a36648d-0c97-4aa5-b753-2872ea2e0ac6"
	TplTicketMrvFailure Template = "9676f8e5-988c-4d5f-802b-a92f619a7ef0"
	TplTicketLgtm       Template = "33a3d82e-bb2b-4428-8c45-6a8e50c0ed0c"
	TplUserRegistered   Template = "30f37d4f-2cfa-40f4-8b44-4b660f9c613d"
	TplPasswordUpdated  Template = "69d05ebf-7626-433f-b906-cb69a596f78e"
	TplEmailUpdated     Template = "aa5404c5-ce37-4e01-a41c-75833028e122"
	TplProfileUpdated   Template = "64c110cf-18d5-494c-917e-fc61322c98e0"
	TplUserCreated      Template = "7de2bf1a-c03a-49d0-822a-a1dd1c98bdc1"
	TplCommentCreated   Template = "ac156eb3-9948-4e2f-997f-77fdeceb12ca"
	TplCronCancelled    Template = "ff0a4c66-9356-498a-afff-40a4407d9d8a"
)

邮件模板

Jump to

Keyboard shortcuts

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