conf

package
v0.0.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

func LoadConfig

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 {
	App  AppConfig
	Http ServerConfig
	Grpc ServerConfig
	Web  WebConfig

	// component config
	Logger log.Config
	MySQL  orm.Config
	Trace  trace.Config
}

func Init

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

Init 初始化

func ParseConfig

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

ParseConfig Parse config file

type ServerConfig

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

ServerConfig server config

type WebConfig

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