config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	C = new(Config)
)

Functions

func MustLoad

func MustLoad(path string)

Load config file (toml/json/yaml)

func PrintWithJSON

func PrintWithJSON()

Types

type AppWx

type AppWx struct {
	AppID     string
	AppSecret string
}

type CORS

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

type Config

type Config struct {
	RunMode         string
	DefaultPassword string
	Swagger         bool
	PrintConfig     bool
	HTTP            HTTP
	LogGormHook     LogGormHook
	LogMongoHook    LogMongoHook
	JWTAuth         JWTAuth
	RateLimiter     RateLimiter
	CORS            CORS
	Redis           Redis
	Gorm            Gorm
	MySQL           MySQL
	Postgres        Postgres
	Sqlite3         Sqlite3
	MiniWx          MiniWx
	MpWx            MpWx
	AppWx           AppWx
}

func (*Config) IsDebugMode

func (c *Config) IsDebugMode() bool

type Gorm

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

type HTTP

type HTTP struct {
	Host               string
	Port               int
	CertFile           string
	KeyFile            string
	ShutdownTimeout    int
	MaxContentLength   int64
	MaxReqLoggerLength int `default:"1024"`
	MaxResLoggerLength int
}

type JWTAuth

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

type LogGormHook

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

type LogHook

type LogHook string

func (LogHook) IsGorm

func (h LogHook) IsGorm() bool

type LogMongoHook

type LogMongoHook struct {
	Collection string
}

type MiniWx

type MiniWx struct {
	AppID     string
	AppSecret string
}

type MpWx

type MpWx struct {
	AppID     string
	AppSecret string
}

type MySQL

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

func (MySQL) DSN

func (a MySQL) DSN() string

type Postgres

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

func (Postgres) DSN

func (a Postgres) DSN() string

type RateLimiter

type RateLimiter struct {
	Enable  bool
	Count   int64
	RedisDB int
}

type Redis

type Redis struct {
	Addr      string
	Password  string
	DB        int
	KeyPrefix string
}

type Sqlite3

type Sqlite3 struct {
	Path string
}

func (Sqlite3) DSN

func (a Sqlite3) DSN() string

Jump to

Keyboard shortcuts

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