config

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CORSConfig

type CORSConfig struct {
	Enable           bool
	AllowOrigins     []string
	AllowMethods     []string
	AllowHeaders     []string
	AllowCredentials bool
	MaxAge           int
}

CORS 跨域请求配置参数

type CaptchaConfig

type CaptchaConfig struct {
	Store string

	Length          int
	Width           int
	Height          int
	NoiseCount      int
	ShowLineOptions int //
	Source          string
	BgColor         *color.RGBA //
	Fonts           []string    //
	Duration        int

	RedisDB     int
	RedisPrefix string
}

Captcha 图形验证码配置参数

type CasbinConfig

type CasbinConfig struct {
	Enable           bool
	Debug            bool
	Model            string
	AutoLoad         bool
	AutoLoadInternal int
}

Casbin casbin配置参数

type Config

type Config struct {
	System       SystemConfig `mapstructure:"System"  json:"system"`
	HTTP         HTTPConfig   `mapstructure:"HTTP" json:"http"`
	Menu         MenuConfig   `mapstructure:"menu" json:"menu"`
	Casbin       CasbinConfig `mapstructure:"Casbin" json:"casbin"`
	Log          LogConfig    `mapstructure:"Log" json:"log"`
	LogGormHook  LogGormHook
	LogMongoHook LogMongoHook
	Root         RootConfig        `mapstructure:"Root" json:"root"`
	JWTAuth      JWTAuthConfig     `mapstructure:"JWTAuth" json:"jwtAuth"`
	Monitor      MonitorConfig     `mapstructure:"Monitor" json:"monitor"`
	Captcha      CaptchaConfig     `mapstructure:"Captcha" json:"captcha"`
	RateLimiter  RateLimiterConfig `mapstructure:"RateLimiter" json:"rateLimiter"`
	CORS         CORSConfig        `mapstructure:"CORS" json:"CORS"`
	GZIP         GZIPConfig        `mapstructure:"GZIP" json:"GZIP"`
	Redis        RedisConfig       `mapstructure:"Redis" json:"redis"`
	Ent          EntConfig         `mapstructure:"Ent" json:"ent"`
	MySQL        MySQLConfig       `mapstructure:"MySQL" json:"mysql"`
	Postgres     PostgresConfig    `mapstructure:"Postgres" json:"postgres"`
	Sqlite3      Sqlite3Config     `mapstructure:"Sqlite3" json:"sqlite3"`
	RabbitMQ     RabbitMQConfig    `mapstructure:"RabbitMQ" json:"rabbitmq"`
	InfluxDB     InfluxDBConfig    `mapstructure:"InfluxDB" json:"influxdb"`
}

Config 配置参数

func (*Config) IsDebugMode

func (c *Config) IsDebugMode() bool

IsDebugMode 是否是debug模式

type EntConfig added in v1.0.6

type EntConfig struct {
	Debug             bool
	DBType            string
	MaxLifetime       int
	MaxOpenConns      int
	MaxIdleConns      int
	TablePrefix       string
	EnableAutoMigrate bool
}

Ent 配置参数

type GZIPConfig

type GZIPConfig struct {
	Enable             bool
	ExcludedExtentions []string
	ExcludedPaths      []string
}

GZIP gzip压缩

type HTTPConfig

type HTTPConfig struct {
	Host             string
	Port             int
	CertFile         string
	KeyFile          string
	ShutdownTimeout  int
	MaxContentLength int64
	MaxLoggerLength  int `default:"4096"`
}

HTTP http配置参数

type InfluxDBConfig added in v1.0.6

type InfluxDBConfig struct {
	Schema string
	Host   string
	Port   int
	Token  string
	Bucket string
	Org    string
}

Influxdb 配置参数

func (InfluxDBConfig) DSN added in v1.0.6

func (a InfluxDBConfig) DSN() string

DSN 数据库连接串

type JWTAuthConfig

type JWTAuthConfig struct {
	Enable        bool
	SigningMethod string
	SigningKey    string
	Expired       int
	Store         string
	FilePath      string
	RedisDB       int
	RedisPrefix   string
}

JWTAuth 用户认证

type LogConfig

type LogConfig struct {
	Level         int
	Format        string
	Output        string
	OutputFile    string
	EnableHook    bool
	HookLevels    []string
	Hook          LogHook
	HookMaxThread int
	HookMaxBuffer int
}

Log 日志配置参数

type LogGormHook

type LogGormHook struct {
	DBType       string
	MaxLifetime  int
	MaxOpenConns int
	MaxIdleConns int
	Table        string
}

LogGormHook 日志gorm钩子配置

type LogHook

type LogHook string

LogHook 日志钩子

func (LogHook) IsGorm

func (h LogHook) IsGorm() bool

IsGorm 是否是gorm钩子

func (LogHook) IsMongo

func (h LogHook) IsMongo() bool

IsMongo 是否是mongo钩子

type LogMongoHook

type LogMongoHook struct {
	Collection string
}

LogMongoHook 日志mongo钩子配置

type MenuConfig struct {
	Enable bool
	Data   string
}

Menu 菜单配置参数

type MonitorConfig

type MonitorConfig struct {
	Enable    bool
	Addr      string
	ConfigDir string
}

Monitor 监控配置参数

type MySQLConfig

type MySQLConfig struct {
	Host       string
	Port       int
	User       string
	Password   string
	DBName     string
	Parameters string
}

MySQL mysql配置参数

func (MySQLConfig) DSN

func (a MySQLConfig) DSN() string

DSN 数据库连接串

type PostgresConfig

type PostgresConfig struct {
	Host     string
	Port     int
	User     string
	Password string
	DBName   string
	SSLMode  string
}

Postgres postgres配置参数

func (PostgresConfig) DSN

func (a PostgresConfig) DSN() string

DSN 数据库连接串

type RabbitMQConfig added in v1.0.6

type RabbitMQConfig struct {
	Host     string
	Port     int
	User     string
	Password string
}

RabbitMQ 配置参数

func (RabbitMQConfig) DSN added in v1.0.6

func (a RabbitMQConfig) DSN() string

DSN 数据库连接串

type RateLimiterConfig

type RateLimiterConfig struct {
	Enable  bool
	Count   int64
	RedisDB int
}

RateLimiter 请求频率限制配置参数

type RedisConfig

type RedisConfig struct {
	Enable   bool
	Addr     string
	Password string
	Database int
}

Redis redis配置参数

type RootConfig

type RootConfig struct {
	UserName  string
	Password  string
	RealName  string
	FirstName string
	LastName  string
}

Root root用户

type Sqlite3Config

type Sqlite3Config struct {
	Path string
}

Sqlite3 sqlite3配置参数

func (Sqlite3Config) DSN

func (a Sqlite3Config) DSN() string

DSN 数据库连接串

type SystemConfig

type SystemConfig struct {
	RunMode     string `mapstructure:"runMode"  json:"runMode"`
	WWW         string `mapstructure:"www"  json:"www"`
	Swagger     bool   `mapstructure:"swagger"  json:"swagger"`
	PrintConfig bool   `mapstructure:"printConfig"  json:"printconfig"`
}

system redis配置参数

Jump to

Keyboard shortcuts

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