config

package
v1.3.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2021 License: Apache-2.0 Imports: 4 Imported by: 33

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DatabaseConfig  = new(Database)
	DatabasesConfig = make(map[string]*Database)
)
View Source
var ApplicationConfig = new(Application)
View Source
var (
	ExtendConfig interface{}
)
View Source
var GenConfig = new(Gen)
View Source
var JwtConfig = new(Jwt)
View Source
var LoggerConfig = new(Logger)
View Source
var SslConfig = new(Ssl)

Functions

func Setup

func Setup(f func(opts ...source.Option) source.Source, options ...source.Option)

Setup 载入配置文件

func Stop

func Stop()

Stop 停止监听

func Watch

func Watch()

Watch 配置监听, 重载时报错,不影响运行 fixme 数据连接 redis连接还没支持动态配置

Types

type Application

type Application struct {
	ReadTimeout   int
	WriterTimeout int
	Host          string
	Port          int64
	Name          string
	JwtSecret     string
	Mode          string
	DemoMsg       string
	EnableDP      bool
}

type Config

type Config struct {
	Application *Application          `yaml:"application"`
	Ssl         *Ssl                  `yaml:"ssl"`
	Logger      *Logger               `yaml:"logger"`
	Jwt         *Jwt                  `yaml:"jwt"`
	Database    *Database             `yaml:"database"`
	Databases   *map[string]*Database `yaml:"databases"`
	Gen         *Gen                  `yaml:"gen"`
	Extend      interface{}           `yaml:"extend"`
}

Config 配置集合

type DBResolverConfig

type DBResolverConfig struct {
	Sources  []string
	Replicas []string
	Policy   string
	Tables   []string
}

type Database

type Database struct {
	Driver          string
	Source          string
	ConnMaxIdleTime int
	ConnMaxLifetime int
	MaxIdleConns    int
	MaxOpenConns    int
	Registers       []DBResolverConfig
}

type Gen

type Gen struct {
	DBName    string
	FrontPath string
}

type Jwt

type Jwt struct {
	Secret  string
	Timeout int64
}

type Logger

type Logger struct {
	Type      string
	Path      string
	Level     string
	Stdout    string
	EnabledDB bool
}

type Settings

type Settings struct {
	Settings Config `yaml:"settings"`
}

Settings 兼容原先的配置结构

type Ssl

type Ssl struct {
	KeyStr string
	Pem    string
	Enable bool
	Domain string
}

Jump to

Keyboard shortcuts

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