config

package
v0.0.0-...-d152970 Latest Latest
Warning

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

Go to latest
Published: May 16, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProjectName = "hertz-scaffold"
	EnvDev      = "dev"
	EnvTest     = "test"
	EnvOnline   = "online"
)

Variables

This section is empty.

Functions

func GetEnv

func GetEnv() string

func Init

func Init()

Init reads config if set. Set > Flag > Env > Config File > key/Value > Defaults

Types

type AutoGenerated

type AutoGenerated struct {
	Logger  Logger  `yaml:"logger"`
	Hertz   Hertz   `yaml:"hertz"`
	Swagger Swagger `yaml:"swagger"`
	Mysql   Mysql   `yaml:"mysql"`
}

func GetConf

func GetConf() AutoGenerated

GetConf gets configuration instance

type Gorm

type Gorm struct {
	IgnoreRecordNotFoundError bool `yaml:"ignoreRecordNotFoundError"`
	SlowThreshold             int  `yaml:"slowThreshold"`
	SkipDefaultTx             bool `yaml:"skipDefaultTx"`
	PrepareStmt               bool `yaml:"prepareStmt"`
}

type Hertz

type Hertz struct {
	EnableAccessLog bool   `yaml:"enableAccessLog"`
	ExitWaitTime    int    `yaml:"exitWaitTime"`
	Address         string `yaml:"address"`
	EnablePprof     bool   `yaml:"enablePprof"`
}

type Logger

type Logger struct {
	LogMaxBackups int    `yaml:"logMaxBackups"`
	Level         string `yaml:"level"`
	Stdout        bool   `yaml:"stdout"`
	LogFileName   string `yaml:"logFileName"`
	LogMaxSize    int    `yaml:"logMaxSize"`
	LogMaxAge     int    `yaml:"logMaxAge"`
}

type Mysql

type Mysql struct {
	ConnMaxOpen               int      `yaml:"connMaxOpen"`
	ConnMaxLifeTime           int      `yaml:"connMaxLifeTime"`
	Separation                bool     `yaml:"separation"`
	Master                    string   `yaml:"master"`
	Slave                     []string `yaml:"slave"`
	DefaultStringSize         int      `yaml:"defaultStringSize"`
	DisableDatetimePrecision  bool     `yaml:"disableDatetimePrecision"`
	ConnMaxIdle               int      `yaml:"connMaxIdle"`
	ConnMaxIdleTime           int      `yaml:"connMaxIdleTime"`
	SkipInitializeWithVersion bool     `yaml:"skipInitializeWithVersion"`
	Gorm                      Gorm     `yaml:"gorm"`
}

type Swagger

type Swagger struct {
	BasePath string `yaml:"basePath"`
	Schemes  string `yaml:"Schemes"`
	Enable   bool   `yaml:"enable"`
	Version  string `yaml:"version"`
	Host     string `yaml:"host"`
}

Jump to

Keyboard shortcuts

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