config

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2023 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 App

type App struct {
	Server struct {
		Http *Service
		Grpc *Service
	}
	Log            *Logger
	Pool           *Pool
	Email          *Email
	JWT            *JWT
	Authentication *Authentication
	Database       map[string]Database
	Redis          map[string]Redis
	Cert           map[string]Cert
	Captcha        map[string]Captcha
}

func Load

func Load(config config.Config) (*App, error)

type Authentication

type Authentication struct {
	DB        string
	Redis     string
	Whitelist map[string]bool
}

type Captcha

type Captcha struct {
	Type     string
	Length   int
	Expire   time.Duration
	Redis    string
	Height   int
	Width    int
	Skew     float64
	DotCount int
	Template string
}

type Cert

type Cert struct {
	Enable bool
	Path   string
}

type Database

type Database struct {
	Enable        bool
	TablePrefix   string
	Drive         string
	Dsn           string
	MaxLifetime   time.Duration
	MaxOpenConn   int
	MaxIdleConn   int
	LogLevel      int
	PrepareStmt   bool
	DryRun        bool
	SlowThreshold time.Duration
}

type Email

type Email struct {
	User     string
	Password string
	Host     string
	Port     int
	Template map[string]EmailTemplate
}

type EmailTemplate

type EmailTemplate struct {
	Subject string
	Path    string
	Enable  *bool
	From    string
	Type    string
}

type JWT

type JWT struct {
	Header    string
	Secret    string
	Expire    time.Duration
	Redis     string
	Whitelist map[string]bool
}

type Logger

type Logger struct {
	Level  int8
	Output []string
	File   *struct {
		Name      string
		MaxSize   int
		MaxBackup int
		MaxAge    int
		Compress  bool
		LocalTime bool
	}
}

type Pool

type Pool struct {
	Size             int
	ExpiryDuration   time.Duration
	PreAlloc         bool
	MaxBlockingTasks int
	Nonblocking      bool
}

type Redis

type Redis struct {
	Enable   bool
	Name     string
	Host     string
	Username string
	Password string
}

type Service

type Service struct {
	Network        string
	Addr           string
	Timeout        time.Duration
	FormatResponse bool
}

Jump to

Keyboard shortcuts

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