config

package
v0.0.0-...-6819526 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Bootstrap = &bootstrap{}

Functions

This section is empty.

Types

type App

type App struct {
	Name    string // 服务名
	Version string // 版本号
	Server  struct {
		Http Transport
		Rpc  Transport
	}
	ServiceKV map[string]any `yaml:"serviceKV"` // 业务自定义kv
}

App 应用服务相关配置信息

type Configuration

type Configuration struct {
	// contains filtered or unexported fields
}

func New

func New() *Configuration

func (*Configuration) App

func (c *Configuration) App() App

func (*Configuration) AppServiceKV

func (c *Configuration) AppServiceKV() map[string]any

func (*Configuration) Config

func (c *Configuration) Config() config

func (*Configuration) Database

func (c *Configuration) Database() Database

func (*Configuration) Log

func (c *Configuration) Log() Log

func (*Configuration) Redis

func (c *Configuration) Redis() Redis

func (*Configuration) Sync

func (c *Configuration) Sync(data []byte) error

Sync 局部更新

type Database

type Database struct {
	Driver string // mysql
	Source string // root:root@tcp(127.0.0.1:3306)/test
}

type FileMetadata

type FileMetadata struct {
	Namespace string
	Group     string
	Filenames []string
}

type Log

type Log struct {
	Level       string // 日志级别 默认值是 info
	FileSizeMax uint16 `yaml:"fileSizeMax"`             // 单位是MB 默认值是 10MB
	FileAgeMax  uint16 `yaml:"fileAgeMax"`              // 留存天数
	DirPath     string `validator:"dir" yaml:"dirPath"` // 日志文件夹路径 默认 ./logs
}

Log config model

日志文件名 xxx/logs/${App.Service}-2006-01-01-150405.log

type Redis

type Redis struct {
	Addr         []string // [127.0.0.1:6379, 127.0.0.1:7000]
	Password     string
	ReadTimeout  string `yaml:"readTimeout"`  // 0.2s
	WriteTimeout string `yaml:"writeTimeout"` // 0.2s
}

type Transport

type Transport struct {
	Addr    string // 0.0.0.0:8000
	Timeout string // 1s
}

Transport 传输协议

Jump to

Keyboard shortcuts

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