conf

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrFileNotExist = func(f string) error { return errors.Newf("config file not exist:%v", f) }
	ErrNoCfgSource  = errors.Newf("no found config source")
)
View Source
var File_common_conf_public_proto protoreflect.FileDescriptor

Functions

func Bootstrap

func Bootstrap(scanTarget []ScanTarget, onChanges CfgOnChanges)

根据运行环境,加载指定的配置文件cfgFile, 并解析到指定的结构scanTarget,注册配置更新回调函数onChanges

func MustNewNacosSource

func MustNewNacosSource(group, cfgFile string) kcfg.Source

func NewNacosSource

func NewNacosSource(group, cfgFile string) (kcfg.Source, error)

配置中心的地址需通过环境变量配置,其他配置从配置文件获取

Types

type Adapter

type Adapter struct {
	Database *Adapter_Database `protobuf:"bytes,1,opt,name=database,proto3" json:"database,omitempty"`
	Redis    *Adapter_Redis    `protobuf:"bytes,2,opt,name=redis,proto3" json:"redis,omitempty"`
	// contains filtered or unexported fields
}

func (*Adapter) Descriptor deprecated

func (*Adapter) Descriptor() ([]byte, []int)

Deprecated: Use Adapter.ProtoReflect.Descriptor instead.

func (*Adapter) GetDatabase

func (x *Adapter) GetDatabase() *Adapter_Database

func (*Adapter) GetRedis

func (x *Adapter) GetRedis() *Adapter_Redis

func (*Adapter) ProtoMessage

func (*Adapter) ProtoMessage()

func (*Adapter) ProtoReflect

func (x *Adapter) ProtoReflect() protoreflect.Message

func (*Adapter) Reset

func (x *Adapter) Reset()

func (*Adapter) String

func (x *Adapter) String() string

type Adapter_Database

type Adapter_Database struct {
	Driver string `protobuf:"bytes,1,opt,name=driver,proto3" json:"driver,omitempty"`
	Source string `protobuf:"bytes,2,opt,name=source,proto3" json:"source,omitempty"`
	// contains filtered or unexported fields
}

func (*Adapter_Database) Descriptor deprecated

func (*Adapter_Database) Descriptor() ([]byte, []int)

Deprecated: Use Adapter_Database.ProtoReflect.Descriptor instead.

func (*Adapter_Database) GetDriver

func (x *Adapter_Database) GetDriver() string

func (*Adapter_Database) GetSource

func (x *Adapter_Database) GetSource() string

func (*Adapter_Database) ProtoMessage

func (*Adapter_Database) ProtoMessage()

func (*Adapter_Database) ProtoReflect

func (x *Adapter_Database) ProtoReflect() protoreflect.Message

func (*Adapter_Database) Reset

func (x *Adapter_Database) Reset()

func (*Adapter_Database) String

func (x *Adapter_Database) String() string

type Adapter_Redis

type Adapter_Redis struct {
	Addr         string               `protobuf:"bytes,1,opt,name=addr,proto3" json:"addr,omitempty"`
	ReadTimeout  *durationpb.Duration `protobuf:"bytes,2,opt,name=read_timeout,json=readTimeout,proto3" json:"read_timeout,omitempty"`
	WriteTimeout *durationpb.Duration `protobuf:"bytes,3,opt,name=write_timeout,json=writeTimeout,proto3" json:"write_timeout,omitempty"`
	// contains filtered or unexported fields
}

func (*Adapter_Redis) Descriptor deprecated

func (*Adapter_Redis) Descriptor() ([]byte, []int)

Deprecated: Use Adapter_Redis.ProtoReflect.Descriptor instead.

func (*Adapter_Redis) GetAddr

func (x *Adapter_Redis) GetAddr() string

func (*Adapter_Redis) GetReadTimeout

func (x *Adapter_Redis) GetReadTimeout() *durationpb.Duration

func (*Adapter_Redis) GetWriteTimeout

func (x *Adapter_Redis) GetWriteTimeout() *durationpb.Duration

func (*Adapter_Redis) ProtoMessage

func (*Adapter_Redis) ProtoMessage()

func (*Adapter_Redis) ProtoReflect

func (x *Adapter_Redis) ProtoReflect() protoreflect.Message

func (*Adapter_Redis) Reset

func (x *Adapter_Redis) Reset()

func (*Adapter_Redis) String

func (x *Adapter_Redis) String() string

type CfgOnChanges added in v0.1.0

type CfgOnChanges map[string]func(key string, value kcfg.Value)

type Discovery

type Discovery struct {
	Endpoints []string `protobuf:"bytes,1,rep,name=endpoints,proto3" json:"endpoints,omitempty"`
	// contains filtered or unexported fields
}

func (*Discovery) Descriptor deprecated

func (*Discovery) Descriptor() ([]byte, []int)

Deprecated: Use Discovery.ProtoReflect.Descriptor instead.

func (*Discovery) GetEndpoints

func (x *Discovery) GetEndpoints() []string

func (*Discovery) ProtoMessage

func (*Discovery) ProtoMessage()

func (*Discovery) ProtoReflect

func (x *Discovery) ProtoReflect() protoreflect.Message

func (*Discovery) Reset

func (x *Discovery) Reset()

func (*Discovery) String

func (x *Discovery) String() string

type File

type File struct {
	MaxSize    int32 `protobuf:"varint,1,opt,name=max_size,json=maxSize,proto3" json:"max_size,omitempty"`
	MaxBackups int32 `protobuf:"varint,2,opt,name=max_backups,json=maxBackups,proto3" json:"max_backups,omitempty"`
	MaxAge     int32 `protobuf:"varint,3,opt,name=max_age,json=maxAge,proto3" json:"max_age,omitempty"`
	Compress   bool  `protobuf:"varint,4,opt,name=compress,proto3" json:"compress,omitempty"`
	// contains filtered or unexported fields
}

func (*File) Descriptor deprecated

func (*File) Descriptor() ([]byte, []int)

Deprecated: Use File.ProtoReflect.Descriptor instead.

func (*File) GetCompress

func (x *File) GetCompress() bool

func (*File) GetMaxAge

func (x *File) GetMaxAge() int32

func (*File) GetMaxBackups

func (x *File) GetMaxBackups() int32

func (*File) GetMaxSize

func (x *File) GetMaxSize() int32

func (*File) ProtoMessage

func (*File) ProtoMessage()

func (*File) ProtoReflect

func (x *File) ProtoReflect() protoreflect.Message

func (*File) Reset

func (x *File) Reset()

func (*File) String

func (x *File) String() string

type GatewayRegister added in v0.1.1

type GatewayRegister struct {
	Endpoints []string `protobuf:"bytes,1,rep,name=endpoints,proto3" json:"endpoints,omitempty"`
	// contains filtered or unexported fields
}

func (*GatewayRegister) Descriptor deprecated added in v0.1.1

func (*GatewayRegister) Descriptor() ([]byte, []int)

Deprecated: Use GatewayRegister.ProtoReflect.Descriptor instead.

func (*GatewayRegister) GetEndpoints added in v0.1.1

func (x *GatewayRegister) GetEndpoints() []string

func (*GatewayRegister) ProtoMessage added in v0.1.1

func (*GatewayRegister) ProtoMessage()

func (*GatewayRegister) ProtoReflect added in v0.1.1

func (x *GatewayRegister) ProtoReflect() protoreflect.Message

func (*GatewayRegister) Reset added in v0.1.1

func (x *GatewayRegister) Reset()

func (*GatewayRegister) String added in v0.1.1

func (x *GatewayRegister) String() string

type Log

type Log struct {
	Level   string   `protobuf:"bytes,1,opt,name=level,proto3" json:"level,omitempty"`
	Monitor *Monitor `protobuf:"bytes,2,opt,name=monitor,proto3" json:"monitor,omitempty"`
	File    *File    `protobuf:"bytes,3,opt,name=file,proto3" json:"file,omitempty"`
	// contains filtered or unexported fields
}

func (*Log) Descriptor deprecated

func (*Log) Descriptor() ([]byte, []int)

Deprecated: Use Log.ProtoReflect.Descriptor instead.

func (*Log) GetFile

func (x *Log) GetFile() *File

func (*Log) GetLevel

func (x *Log) GetLevel() string

func (*Log) GetMonitor

func (x *Log) GetMonitor() *Monitor

func (*Log) ProtoMessage

func (*Log) ProtoMessage()

func (*Log) ProtoReflect

func (x *Log) ProtoReflect() protoreflect.Message

func (*Log) Reset

func (x *Log) Reset()

func (*Log) String

func (x *Log) String() string

type Monitor

type Monitor struct {
	Endpoint string `protobuf:"bytes,1,opt,name=endpoint,proto3" json:"endpoint,omitempty"`
	// contains filtered or unexported fields
}

func (*Monitor) Descriptor deprecated

func (*Monitor) Descriptor() ([]byte, []int)

Deprecated: Use Monitor.ProtoReflect.Descriptor instead.

func (*Monitor) GetEndpoint

func (x *Monitor) GetEndpoint() string

func (*Monitor) ProtoMessage

func (*Monitor) ProtoMessage()

func (*Monitor) ProtoReflect

func (x *Monitor) ProtoReflect() protoreflect.Message

func (*Monitor) Reset

func (x *Monitor) Reset()

func (*Monitor) String

func (x *Monitor) String() string

type Public

type Public struct {
	Log             *Log             `protobuf:"bytes,1,opt,name=log,proto3" json:"log,omitempty"`
	Trace           *Trace           `protobuf:"bytes,2,opt,name=trace,proto3" json:"trace,omitempty"`
	Registry        *Registry        `protobuf:"bytes,3,opt,name=registry,proto3" json:"registry,omitempty"`
	Discovery       *Discovery       `protobuf:"bytes,4,opt,name=discovery,proto3" json:"discovery,omitempty"`
	Adapter         *Adapter         `protobuf:"bytes,5,opt,name=adapter,proto3" json:"adapter,omitempty"`
	GatewayRegister *GatewayRegister `protobuf:"bytes,6,opt,name=gateway_register,json=gatewayRegister,proto3" json:"gateway_register,omitempty"`
	// contains filtered or unexported fields
}

func (*Public) Descriptor deprecated

func (*Public) Descriptor() ([]byte, []int)

Deprecated: Use Public.ProtoReflect.Descriptor instead.

func (*Public) GetAdapter

func (x *Public) GetAdapter() *Adapter

func (*Public) GetDiscovery

func (x *Public) GetDiscovery() *Discovery

func (*Public) GetGatewayRegister added in v0.1.1

func (x *Public) GetGatewayRegister() *GatewayRegister

func (*Public) GetLog

func (x *Public) GetLog() *Log

func (*Public) GetRegistry

func (x *Public) GetRegistry() *Registry

func (*Public) GetTrace

func (x *Public) GetTrace() *Trace

func (*Public) ProtoMessage

func (*Public) ProtoMessage()

func (*Public) ProtoReflect

func (x *Public) ProtoReflect() protoreflect.Message

func (*Public) Reset

func (x *Public) Reset()

func (*Public) String

func (x *Public) String() string

type Registry

type Registry struct {
	Addrs []string `protobuf:"bytes,1,rep,name=addrs,proto3" json:"addrs,omitempty"`
	// contains filtered or unexported fields
}

func (*Registry) Descriptor deprecated

func (*Registry) Descriptor() ([]byte, []int)

Deprecated: Use Registry.ProtoReflect.Descriptor instead.

func (*Registry) GetAddrs

func (x *Registry) GetAddrs() []string

func (*Registry) ProtoMessage

func (*Registry) ProtoMessage()

func (*Registry) ProtoReflect

func (x *Registry) ProtoReflect() protoreflect.Message

func (*Registry) Reset

func (x *Registry) Reset()

func (*Registry) String

func (x *Registry) String() string

type ScanTarget added in v0.1.0

type ScanTarget struct {
	File   string
	Field  string
	Target interface{}
}

type Trace

type Trace struct {
	Endpoint string `protobuf:"bytes,1,opt,name=endpoint,proto3" json:"endpoint,omitempty"`
	// contains filtered or unexported fields
}

func (*Trace) Descriptor deprecated

func (*Trace) Descriptor() ([]byte, []int)

Deprecated: Use Trace.ProtoReflect.Descriptor instead.

func (*Trace) GetEndpoint

func (x *Trace) GetEndpoint() string

func (*Trace) ProtoMessage

func (*Trace) ProtoMessage()

func (*Trace) ProtoReflect

func (x *Trace) ProtoReflect() protoreflect.Message

func (*Trace) Reset

func (x *Trace) Reset()

func (*Trace) String

func (x *Trace) String() string

Jump to

Keyboard shortcuts

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