config

package
v0.0.0-...-32ff608 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2023 License: Apache-2.0 Imports: 5 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ConnectorPluginType plugin type for connector
	// support standalone and rocketmq
	// default to standalone
	ConnectorPluginType = "connector"

	// RegistryPluginType plugin type for connector
	// support nacos and etcd
	// default to nacos
	RegistryPluginType = "registry"
)
View Source
var ServerConfigPath = defaultConfigPath

ServerConfigPath is the file path of server config file.

Functions

func LoadGlobalConfig

func LoadGlobalConfig(configPath string) error

LoadGlobalConfig loads a Config from the config file path and sets it as the global Config.

func SetGlobalConfig

func SetGlobalConfig(cfg *Config)

SetGlobalConfig set the global Config.

Types

type Common

type Common struct {
	Name         string `yaml:"name" toml:"name"`
	RegistryName string `yaml:"registry-name" toml:"registry-name"`
	Cluster      string `yaml:"cluster" toml:"cluster"`
	Env          string `yaml:"env" toml:"env"`
	IDC          string `yaml:"idc" toml:"idc"`
}

type Config

type Config struct {
	Common *Common `yaml:"common" toml:"common"`
	Server struct {
		*HTTPOption `yaml:"http" toml:"http"`
		*GRPCOption `yaml:"grpc" toml:"grpc"`
		*TCPOption  `yaml:"tcp" toml:"tcp"`
	}
	PProf         *PProfOption      `yaml:"pprof" toml:"pprof"`
	ActivePlugins map[string]string `yaml:"active-plugins" toml:"active-plugins"`
	Plugins       plugin.Config     `yaml:"plugins,omitempty"`
}

func GlobalConfig

func GlobalConfig() *Config

GlobalConfig returns the global Config.

func LoadConfig

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

LoadConfig loads a Config from the config file path.

type GRPCOption

type GRPCOption struct {
	Port string `yaml:"port" toml:"port"`

	// TLSOption process with the tls configuration
	*TLSOption `yaml:"tls" toml:"tls"`

	// SendPoolSize pool in handle send msg
	// default to 10
	SendPoolSize int `yaml:"send-pool-size" toml:"send-pool-size"`
	// SubscribePoolSize pool in handle subscribe msg
	// default to 10
	SubscribePoolSize int `yaml:"subscribe-pool-size" toml:"subscribe-pool-size"`
	// RetryPoolSize pool in handle retry msg
	// default to 10
	RetryPoolSize int `yaml:"retry-pool-size" toml:"retry-pool-size"`
	// PushMessagePoolSize pool to push message
	// default to 10
	PushMessagePoolSize int `yaml:"push-message-pool-size" toml:"push-message-pool-size"`
	// ReplyPoolSize pool in handle reply msg
	// default to 10
	ReplyPoolSize int `yaml:"reply-pool-size" toml:"reply-pool-size"`

	//MsgReqNumPerSecond
	MsgReqNumPerSecond float64 `yaml:"msg-req-num-per-second" toml:"msg-req-num-per-second"`

	// SessionExpiredInMills internal to clean the not work session consumer
	SessionExpiredInMills time.Duration `yaml:"session-expired-in-mills"`
	// SendMessageTimeout timeout in send message
	// default to 5s
	SendMessageTimeout time.Duration `yaml:"send-message-timeout"`
}

GRPCOption configuratin for grpc server

type HTTPOption

type HTTPOption struct {
	// Port http server listen
	Port string `yaml:"port" toml:"port"`

	// TLSOption process with the tls configuration
	*TLSOption `yaml:"tls" toml:"tls"`
}

HTTPOption option for http/https server

type PProfOption

type PProfOption struct {
	// Enable the pprof or not
	Enable bool `yaml:"enable" toml:"enable"`
	// Port pprof server listen on
	Port       string `yaml:"port" toml:"port"`
	*TLSOption `yaml:"tls" toml:"tls"`
}

PProfOption option to start the prof

type TCPOption

type TCPOption struct {
	// Port http server listen
	Port string `yaml:"port" toml:"port"`

	// Multicore indicates whether the engine will
	// be effectively created with multi-cores
	Multicore bool `yaml:"multicore" toml:"multicore"`

	// TLSOption process with the tls configuration
	*TLSOption `yaml:"tls" toml:"tls"`
}

TCPOption option for eventmesh tcp server

type TLSOption

type TLSOption struct {
	// EnableInsecure enable the insecure request
	EnableInsecure bool `yaml:"enable-secure" toml:"enable-secure"`

	// CA no client authentication is used,
	// and the file CA is used to verify the server certificate
	CA string `yaml:"ca" toml:"ca"`

	//  Certfile client authentication is used with the specified cert/key pair.
	// The server certificate is verified with the system CAs
	Certfile string `yaml:"certfile" toml:"certfile"`

	//  client authentication is used with the specified cert/key pair.
	// The server certificate is verified using the specified CA file
	Keyfile string `yaml:"keyfile" toml:"keyfile"`
}

TLSOption option to tls

Jump to

Keyboard shortcuts

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