conf

package
v1.3.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Conf app global config
	Conf = &Config{}
)

Functions

func LoadConfig added in v1.3.1

func LoadConfig(confPath string) (*viper.Viper, error)

LoadConfig load config file from given path

Types

type AppConfig

type AppConfig struct {
	Name              string
	Version           string
	Mode              string
	PprofPort         string
	URL               string
	JwtSecret         string
	JwtTimeout        int
	SSL               bool
	CtxDefaultTimeout time.Duration
	CSRF              bool
	Debug             bool
}

AppConfig app config

type Config

type Config struct {
	// common
	App    AppConfig
	Http   ServerConfig
	Grpc   ServerConfig
	Web    WebConfig
	Cookie CookieConfig
	QiNiu  QiNiuConfig

	// component config
	Logger  log.Config
	MySQL   orm.Config
	Redis   redis.Config
	Email   email.Config
	Trace   trace.Config
	MongoDB mongodb.Config
}

Config global config include common and biz config

func Init

func Init(configPath string) (*Config, error)

Init init config

func ParseConfig added in v1.3.1

func ParseConfig(v *viper.Viper) (*Config, error)

Parse config file

type CookieConfig added in v1.3.0

type CookieConfig struct {
	Name     string
	MaxAge   int
	Secure   bool
	HttpOnly bool
	Domain   string
	Secret   string
}

CookieConfig cookie config

type QiNiuConfig added in v1.3.0

type QiNiuConfig struct {
	AccessKey   string
	SecretKey   string
	CdnURL      string
	SignatureID string
	TemplateID  string
}

QiNiuConfig qiniu config

type ServerConfig added in v1.3.1

type ServerConfig struct {
	Addr         string
	ReadTimeout  time.Duration
	WriteTimeout time.Duration
}

ServerConfig server config

type WebConfig added in v1.3.0

type WebConfig struct {
	Name   string
	Domain string
	Secret string
	Static string
}

WebConfig web config

Jump to

Keyboard shortcuts

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