config

package
v1.5.3-rc.3 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2024 License: Apache-2.0 Imports: 8 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 CacheConfig = new(Cache)

CacheConfig cache配置

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 QueueConfig = new(Queue)
View Source
var SslConfig = new(Ssl)

Functions

func Setup

func Setup(s source.Source,
	fs ...func())

Setup 载入配置文件

Types

type Application

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

type Cache added in v1.3.6

type Cache struct {
	Memory interface{}
}

func (Cache) Setup added in v1.3.6

func (e Cache) Setup() (storage.AdapterCache, error)

Setup 构造cache 顺序 其他 > memory

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"`
	Cache       *Cache                `yaml:"cache"`
	Queue       *Queue                `yaml:"queue"`
	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
	Cap       uint
}

func (Logger) Setup added in v1.3.6

func (e Logger) Setup()

Setup 设置logger

type Queue added in v1.3.6

type Queue struct {
	Memory *QueueMemory
}

func (Queue) Empty added in v1.3.6

func (e Queue) Empty() bool

Empty 空设置

func (Queue) Setup added in v1.3.6

func (e Queue) Setup() (storage.AdapterQueue, error)

Setup 启用顺序 其他 > memory

type QueueMemory added in v1.3.6

type QueueMemory struct {
	PoolSize uint
}

type Settings

type Settings struct {
	Settings Config `yaml:"settings"`
	// contains filtered or unexported fields
}

Settings 兼容原先的配置结构

func (*Settings) Init added in v1.3.6

func (e *Settings) Init()

func (*Settings) OnChange added in v1.3.6

func (e *Settings) OnChange()

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