conf

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEFAULT_READ_TIMEOUT   int = 5000
	DEFAULT_WRITE_TIMEOUT  int = 5000
	DEFAULT_HANDLE_TIMEOUT int = 5000
	DEFAULT_APP_WAIT           = 5000 // 默认退出等待时间
)
View Source
const (
	MinuteIndex = 0
	HourIndex   = 1
	DomIndex    = 2
	MonthIndex  = 3
	DowIndex    = 4
	NameIndex   = 5
	DescIndex   = 6
)
View Source
const DEFAULT_CONF_FILE = "/data/webroot/golang/crontab.conf"
View Source
const DEFAULT_CRON_WAIT = 5000 // 默认退出等待时间
View Source
const DEFAULT_GRPC_WAIT = 5000 // 统一默认值
View Source
const MIN_FIELDS_COUNT = 6

Variables

This section is empty.

Functions

func InitConf

func InitConf(mode MODE) (err error)

初始化配置

func ParseCronContent

func ParseCronContent() (cronList []string)

将文本形式的cron格式化,去除无效的cron配置

Types

type AppConfig

type AppConfig struct {
	Domain        string `toml:"domain"`        // 域名
	StaticDomain  string `toml:"static_domain"` //静态文件域名
	Addr          string `toml:"listen"`        // 监听地址
	ReadTimeout   int    `toml:"readTimeout"`   // 请求读超时
	HandleTimeout int    `toml:"handleTimeout"` // 请求处理超时
	WriteTimeout  int    `toml:"writeTimeout"`  // 请求写超时
	WaitGraceExit int    `toml:"waitGraceExit"` // 优雅退出等待时间

	// token配置
	TokenAccessSecret string `toml:"token_access_secret"` // token访问密钥
	TokenAccessExpire int64  `toml:"token_access_expire"` // token过期时间
}

APP配置

func DefaultAppConfig

func DefaultAppConfig() (appConfig *AppConfig)

默认App配置

type CronConfig

type CronConfig struct {
	Domain        string `toml:"domain"` // 域名
	WaitGraceExit int    `toml:"waitGraceExit"`
	Content       string `toml:"content"`
	ConfFile      string `toml:"confFile"`
}

Cron配置

func DefaultCronConfig

func DefaultCronConfig() (cronConfig *CronConfig)

默认Cron配置

type GEConfig

type GEConfig struct {
	Mode             MODE              // 模式 app, cron
	Domain           string            `toml:"domain"`      // 域名
	Debug            int               `toml:"debug"`       // 调试模式
	EnableCors       bool              `toml:"enable_cors"` //是否启用跨域
	Pprof            int               `toml:"pprof"`       // 性能采样功能
	Prometheus       int               `toml:"prometheus"`  // 普罗米修斯采集
	AppConfig        *AppConfig        `toml:"App"`         // App配置
	GrpcConfig       *GrpcConfig       `toml:"Grpc"`        // zgrpc-server配置
	CronConfig       *CronConfig       `toml:"Cron"`        // Cron配置
	Redis            *gredis.CACHEConf `toml:"Redis"`       //redis配置
	Mysql            *gmysql.DBConf    `toml:"Mysql"`       // mysql配置
	HttpClientConfig *ghttp.HttpConfig `toml:"HttpClient"`  //http-client配置
	ModuleName       string            `toml:"module_name"`
	CurrentIp        string
}
var (
	GEConf *GEConfig
)

type GrpcConfig

type GrpcConfig struct {
	Domain        string `toml:"domain"`        // 域名
	Addr          string `toml:"listen"`        // 监听地址
	ReadTimeout   int    `toml:"readTimeout"`   // 请求读超时
	HandleTimeout int    `toml:"handleTimeout"` // 请求处理超时
	WriteTimeout  int    `toml:"writeTimeout"`  // 请求写超时
	WaitGraceExit int    `toml:"waitGraceExit"` // 优雅退出等待时间
}

zgrpc-server配置

func DefaultGrpcConfig

func DefaultGrpcConfig() (grpcConfig *GrpcConfig)

默认Grpc配置

type MODE

type MODE string
const MODE_APP MODE = "APP"
const MODE_CRON MODE = "CRON"
const MODE_GRPC MODE = "GRPC"

Jump to

Keyboard shortcuts

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