config

package
v0.0.26 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package config providers configuration type and load configuration logic

Package config providers configuration type and load configuration logic

Package config providers configuration type and load configuration logic

Package config providers configuration type and load configuration logic

Package config providers configuration type and load configuration logic

package config providers configuration type and load configuration logic

Package config providers configuration type and load configuration logic

Package config providers configuration type and load configuration logic

Package config providers configuration type and load configuration logic

Package config providers configuration type and load configuration logic

Package config providers configuration type and load configuration logic

Package config providers configuration type and load configuration logic

Package config providers configuration type and load configuration logic

Package config providers configuration type and load configuration logic

Package config providers configuration type and load configuration logic

Package config providers configuration type and load configuration logic

Package config providers configuration type and load configuration logic

Package config providers configuration type and load configuration logic

Package config providers configuration type and load configuration logic

Package config providers configuration type and load configuration logic

Package config providers configuration type and load configuration logic

Package config providers configuration type and load configuration logic

Index

Constants

View Source
const (
	GOB compressAlgorithm = iota
	GZIP
	LZ4
	ZSTD
)

Variables

This section is empty.

Functions

func CompressAlgorithm

func CompressAlgorithm(ca string) compressAlgorithm

func GetActualValue

func GetActualValue(val string) (res string)

GetActualValue returns the environment variable value if the val has prefix and suffix "_", if actual value start with file://{path} the return value will read from file otherwise the val will directly return.

func GetActualValues

func GetActualValues(vals []string) []string

func Read

func Read(path string, cfg interface{}) error

New returns config struct or error when decode the configuration file to actually *Config struct.

func ToRawYaml

func ToRawYaml(data interface{}) string

Types

type Backoff

type Backoff struct {
	InitialDuration  string  `json:"initial_duration" yaml:"initial_duration"`
	BackoffTimeLimit string  `json:"backoff_time_limit" yaml:"backoff_time_limit"`
	MaximumDuration  string  `json:"maximum_duration" yaml:"maximum_duration"`
	JitterLimit      string  `json:"jitter_limit" yaml:"jitter_limit"`
	BackoffFactor    float64 `json:"backoff_factor" yaml:"backoff_factor"`
	RetryCount       int     `json:"retry_count" yaml:"retry_count"`
	EnableErrorLog   bool    `json:"enable_error_log" yaml:"enable_error_log"`
}

func (*Backoff) Bind

func (b *Backoff) Bind() *Backoff

func (*Backoff) Opts

func (b *Backoff) Opts() []backoff.Option

type BackupManager

type BackupManager struct {
	Host   string      `json:"host" yaml:"host"`
	Port   int         `json:"port" yaml:"port"`
	Client *GRPCClient `json:"client" yaml:"client"`
}

func (*BackupManager) Bind

func (b *BackupManager) Bind() *BackupManager

type CallOption

type CallOption struct {
	WaitForReady          bool `json:"wait_for_ready" yaml:"wait_for_ready"`
	MaxRetryRPCBufferSize int  `json:"max_retry_rpc_buffer_size" yaml:"max_retry_rpc_buffer_size"`
	MaxRecvMsgSize        int  `json:"max_recv_msg_size" yaml:"max_recv_msg_size"`
	MaxSendMsgSize        int  `json:"max_send_msg_size" yaml:"max_send_msg_size"`
}

func (*CallOption) Bind

func (c *CallOption) Bind() *CallOption

type Cassandra

type Cassandra struct {
	Hosts          []string `json:"hosts" yaml:"hosts"`
	CQLVersion     string   `json:"cql_version" yaml:"cql_version"`
	ProtoVersion   int      `json:"proto_version" yaml:"proto_version"`
	Timeout        string   `json:"timeout" yaml:"timeout"`
	ConnectTimeout string   `json:"connect_timeout" yaml:"connect_timeout"`
	Port           int      `json:"port" yaml:"port"`
	Keyspace       string   `json:"keyspace" yaml:"keyspace"`
	NumConns       int      `json:"num_conns" yaml:"num_conns"`
	Consistency    string   `json:"consistency" yaml:"consistency"`

	Username string `json:"username" yaml:"username"`
	Password string `json:"password" yaml:"password"`

	PoolConfig         *PoolConfig         `json:"pool_config" yaml:"pool_config"`
	RetryPolicy        *RetryPolicy        `json:"retry_policy" yaml:"retry_policy"`
	ReconnectionPolicy *ReconnectionPolicy `json:"reconnection_policy" yaml:"reconnection_policy"`

	SocketKeepalive          string `json:"socket_keepalive" yaml:"socket_keepalive"`
	MaxPreparedStmts         int    `json:"max_prepared_stmts" yaml:"max_prepared_stmts"`
	MaxRoutingKeyInfo        int    `json:"max_routing_key_info" yaml:"max_routing_key_info"`
	PageSize                 int    `json:"page_size" yaml:"page_size"`
	TLS                      *TLS   `json:"tls" yaml:"tls"`
	TCP                      *TCP   `json:"tcp" yaml:"tcp"`
	EnableHostVerification   bool   `json:"enable_host_verification" yaml:"enable_host_verification"`
	DefaultTimestamp         bool   `json:"default_timestamp" yaml:"default_timestamp"`
	ReconnectInterval        string `json:"reconnect_interval" yaml:"reconnect_interval"`
	MaxWaitSchemaAgreement   string `json:"max_wait_schema_agreement" yaml:"max_wait_schema_agreement"`
	IgnorePeerAddr           bool   `json:"ignore_peer_addr" yaml:"ignore_peer_addr"`
	DisableInitialHostLookup bool   `json:"disable_initial_host_lookup" yaml:"disable_initial_host_lookup"`
	DisableNodeStatusEvents  bool   `json:"disable_node_status_events" yaml:"disable_node_status_events"`
	DisableTopologyEvents    bool   `json:"disable_topology_events" yaml:"disable_topology_events"`
	DisableSchemaEvents      bool   `json:"disable_schema_events" yaml:"disable_schema_events"`
	DisableSkipMetadata      bool   `json:"disable_skip_metadata" yaml:"disable_skip_metadata"`
	DefaultIdempotence       bool   `json:"default_idempotence" yaml:"default_idempotence"`
	WriteCoalesceWaitTime    string `json:"write_coalesce_wait_time" yaml:"write_coalesce_wait_time"`

	// meta
	KVTable string `json:"kv_table" yaml:"kv_table"`
	VKTable string `json:"vk_table" yaml:"vk_table"`

	// backup manager
	MetaTable string `json:"meta_table" yaml:"meta_table"`
}

func (*Cassandra) Bind

func (c *Cassandra) Bind() *Cassandra

func (*Cassandra) Opts

func (cfg *Cassandra) Opts() (opts []cassandra.Option, err error)

type Client

type Client struct {
	TCP       *TCP       `json:"tcp" yaml:"tcp"`
	Transport *Transport `json:"transport" yaml:"transport"`
}

func (*Client) Bind

func (c *Client) Bind() *Client

type Collector added in v0.0.19

type Collector struct {
	Duration string   `json:"duration" yaml:"duration"`
	Metrics  *Metrics `json:"metrics" yaml:"metrics"`
}

type Compressor

type Compressor struct {
	CompressAlgorithm string `json:"compress_algorithm" yaml:"compress_algorithm"`
	CompressionLevel  int    `json:"compression_level" yaml:"compression_level"`
	ConcurrentLimit   int    `json:"concurrent_limit" yaml:"concurrent_limit"`
	Buffer            int    `json:"buffer" yaml:"buffer"`
}

func (*Compressor) Bind

func (c *Compressor) Bind() *Compressor

type DNS

type DNS struct {
	CacheEnabled    bool   `yaml:"cache_enabled" json:"cache_enabled"`
	RefreshDuration string `yaml:"refresh_duration" json:"refresh_duration"`
	CacheExpiration string `yaml:"cache_expiration" json:"cache_expiration"`
}

func (*DNS) Bind

func (d *DNS) Bind() *DNS

type Debug

type Debug struct {
	// Profile represent profiling the server
	Profile struct {
		Enable bool    `yaml:"enable" json:"enable"`
		Server *Server `yaml:"server" json:"server"`
	} `yaml:"profile" json:"profile"`

	// Log represent the server enable debug log or not.
	Log struct {
		Level string `yaml:"level" json:"level"`
		Mode  string `yaml:"mode" json:"mode"`
	} `yaml:"log" json:"log"`
}

func (*Debug) Bind

func (d *Debug) Bind() *Debug

type DialOption

type DialOption struct {
	WriteBufferSize             int                  `json:"write_buffer_size" yaml:"write_buffer_size"`
	ReadBufferSize              int                  `json:"read_buffer_size" yaml:"read_buffer_size"`
	InitialWindowSize           int                  `json:"initial_window_size" yaml:"initial_window_size"`
	InitialConnectionWindowSize int                  `json:"initial_connection_window_size" yaml:"initial_connection_window_size"`
	MaxMsgSize                  int                  `json:"max_msg_size" yaml:"max_msg_size"`
	MaxBackoffDelay             string               `json:"max_backoff_delay" yaml:"max_backoff_delay"`
	EnableBackoff               bool                 `json:"enable_backoff" yaml:"enable_backoff"`
	Insecure                    bool                 `json:"insecure" yaml:"insecure"`
	Timeout                     string               `json:"timeout" yaml:"timeout"`
	TCP                         *TCP                 `json:"tcp" yaml:"tcp"`
	KeepAlive                   *GRPCClientKeepalive `json:"keep_alive" yaml:"keep_alive"`
}

func (*DialOption) Bind

func (d *DialOption) Bind() *DialOption

type Dialer

type Dialer struct {
	Timeout          string `yaml:"timeout" json:"timeout"`
	KeepAlive        string `yaml:"keep_alive" json:"keep_alive"`
	DualStackEnabled bool   `yaml:"dual_stack_enabled" json:"dual_stack_enabled"`
}

func (*Dialer) Bind

func (d *Dialer) Bind() *Dialer

type Discoverer

type Discoverer struct {
	Name              string `json:"name" yaml:"name"`
	Namespace         string `json:"namespace" yaml:"namespace"`
	CacheSyncDuration string `json:"cache_sync_duration" yaml:"cache_sync_duration"`
}

func (*Discoverer) Bind

func (d *Discoverer) Bind() *Discoverer

type DiscovererClient added in v0.0.5

type DiscovererClient struct {
	Host        string      `json:"host" yaml:"host"`
	Port        int         `json:"port" yaml:"port"`
	Duration    string      `json:"duration" yaml:"duration"`
	Client      *GRPCClient `json:"discover_client" yaml:"discover_client"`
	AgentClient *GRPCClient `json:"agent_client" yaml:"agent_client"`
}

func (*DiscovererClient) Bind added in v0.0.5

type EgressFilter

type EgressFilter struct {
	Client *GRPCClient `json:"client" yaml:"client"`
}

func (*EgressFilter) Bind

func (e *EgressFilter) Bind() *EgressFilter

type GRPC

type GRPC struct {
	BidirectionalStreamConcurrency int            `json:"bidirectional_stream_concurrency" yaml:"bidirectional_stream_concurrency"`
	MaxReceiveMessageSize          int            `json:"max_receive_message_size" yaml:"max_receive_message_size"`
	MaxSendMessageSize             int            `json:"max_send_message_size" yaml:"max_send_message_size"`
	InitialWindowSize              int            `json:"initial_window_size" yaml:"initial_window_size"`
	InitialConnWindowSize          int            `json:"initial_conn_window_size" yaml:"initial_conn_window_size"`
	Keepalive                      *GRPCKeepalive `json:"keepalive" yaml:"keepalive"`
	WriteBufferSize                int            `json:"write_buffer_size" yaml:"write_buffer_size"`
	ReadBufferSize                 int            `json:"read_buffer_size" yaml:"read_buffer_size"`
	ConnectionTimeout              string         `json:"connection_timeout" yaml:"connection_timeout"`
	MaxHeaderListSize              int            `json:"max_header_list_size" yaml:"max_header_list_size"`
	HeaderTableSize                int            `json:"header_table_size" yaml:"header_table_size"`
	Interceptors                   []string       `json:"interceptors" yaml:"interceptors"`
}

func (*GRPC) Bind

func (g *GRPC) Bind() *GRPC

type GRPCClient

type GRPCClient struct {
	Addrs               []string    `json:"addrs" yaml:"addrs"`
	HealthCheckDuration string      `json:"health_check_duration" yaml:"health_check_duration"`
	ConnectionPool      int         `json:"connection_pool" yaml:"connection_pool"`
	Backoff             *Backoff    `json:"backoff" yaml:"backoff"`
	CallOption          *CallOption `json:"call_option" yaml:"call_option"`
	DialOption          *DialOption `json:"dial_option" yaml:"dial_option"`
	TLS                 *TLS        `json:"tls" yaml:"tls"`
}

func (*GRPCClient) Bind

func (g *GRPCClient) Bind() *GRPCClient

func (*GRPCClient) Opts

func (g *GRPCClient) Opts() []grpc.Option

type GRPCClientKeepalive

type GRPCClientKeepalive struct {
	Time                string `json:"time" yaml:"time"`
	Timeout             string `json:"timeout" yaml:"timeout"`
	PermitWithoutStream bool   `json:"permit_without_stream" yaml:"permit_without_stream"`
}

func (*GRPCClientKeepalive) Bind

type GRPCKeepalive

type GRPCKeepalive struct {
	MaxConnIdle     string `json:"max_conn_idle" yaml:"max_conn_idle"`
	MaxConnAge      string `json:"max_conn_age" yaml:"max_conn_age"`
	MaxConnAgeGrace string `json:"max_conn_age_grace" yaml:"max_conn_age_grace"`
	Time            string `json:"time" yaml:"time"`
	Timeout         string `json:"timeout" yaml:"timeout"`
}

func (*GRPCKeepalive) Bind

func (k *GRPCKeepalive) Bind() *GRPCKeepalive

type Gateway

type Gateway struct {
	// AgentPort represent agent port number
	AgentPort int `json:"agent_port" yaml:"agent_port"`

	// AgentName represent agents meta_name for service discovery
	AgentName string `json:"agent_name" yaml:"agent_name"`

	// AgentNamespace represent agent namespace location
	AgentNamespace string `json:"agent_namespace" yaml:"agent_namespace"`

	// AgentDNS represent agents dns A record for service discovery
	AgentDNS string `json:"agent_dns" yaml:"agent_dns"`

	// NodeName represents node name
	NodeName string `json:"node_name" yaml:"node_name"`

	// IndexReplica represents index replication count
	IndexReplica int `json:"index_replica" yaml:"index_replica"`

	// Discoverer represent agent discoverer service configuration
	Discoverer *DiscovererClient `json:"discoverer" yaml:"discoverer"`

	// Meta represent meta data service configuration
	Meta *Meta `json:"meta" yaml:"meta"`

	// BackupManager represent backup manager configuration
	BackupManager *BackupManager `json:"backup" yaml:"backup"`

	// EgressFilter represents egress filter configuration
	EgressFilter *EgressFilter `json:"egress_filter" yaml:"egress_filter"`
}

func (*Gateway) Bind

func (g *Gateway) Bind() *Gateway

type GlobalConfig added in v0.0.2

type GlobalConfig struct {
	// Version represent configuration file version.
	Version string `json:"version" yaml:"version"`

	// TZ represent system time location .
	TZ string `json:"time_zone" yaml:"time_zone"`

	// Log represent log configuration.
	Logging *Logging `json:"logging,omitempty" yaml:"logging,omitempty"`
}

GlobalConfig represent a application setting data content (config.yaml).

func (*GlobalConfig) Bind added in v0.0.2

func (c *GlobalConfig) Bind() *GlobalConfig

func (*GlobalConfig) UnmarshalJSON added in v0.0.2

func (c *GlobalConfig) UnmarshalJSON(data []byte) (err error)

type HTTP

type HTTP struct {
	ShutdownDuration  string `json:"shutdown_duration" yaml:"shutdown_duration"`
	HandlerTimeout    string `json:"handler_timeout" yaml:"handler_timeout"`
	IdleTimeout       string `json:"idle_timeout" yaml:"idle_timeout"`
	ReadHeaderTimeout string `json:"read_header_timeout" yaml:"read_header_timeout"`
	ReadTimeout       string `json:"read_timeout" yaml:"read_timeout"`
	WriteTimeout      string `json:"write_timeout" yaml:"write_timeout"`
}

func (*HTTP) Bind

func (h *HTTP) Bind() *HTTP

type Indexer added in v0.0.5

type Indexer struct {
	// AgentPort represent agent port number
	AgentPort int `json:"agent_port" yaml:"agent_port"`

	// AgentName represent agents meta_name for service discovery
	AgentName string `json:"agent_name" yaml:"agent_name"`

	// AgentNamespace represent agent namespace location
	AgentNamespace string `json:"agent_namespace" yaml:"agent_namespace"`

	// AgentDNS represent agents dns A record for service discovery
	AgentDNS string `json:"agent_dns" yaml:"agent_dns"`

	// Concurrency represents indexing concurrency
	Concurrency int `json:"concurrency" yaml:"concurrency"`

	// AutoIndexLimit auto indexing duration limit
	AutoIndexDurationLimit string `yaml:"auto_index_duration_limit" json:"auto_index_duration_limit"`

	// AutoIndexCheckDuration represent checking loop duration about auto indexing execution
	AutoIndexCheckDuration string `yaml:"auto_index_check_duration" json:"auto_index_check_duration"`

	// AutoIndexLength represent minimum auto index length
	AutoIndexLength uint32 `yaml:"auto_index_length" json:"auto_index_length"`

	// NodeName represents node name
	NodeName string `json:"node_name" yaml:"node_name"`

	// Discoverer represent agent discoverer service configuration
	Discoverer *DiscovererClient `json:"discoverer" yaml:"discoverer"`
}

func (*Indexer) Bind added in v0.0.5

func (im *Indexer) Bind() *Indexer

type Jaeger added in v0.0.19

type Jaeger struct {
	Enabled bool `json:"enabled" yaml:"enabled"`

	CollectorEndpoint string `json:"collector_endpoint" yaml:"collector_endpoint"`
	AgentEndpoint     string `json:"agent_endpoint" yaml:"agent_endpoint"`

	Username string `json:"username" yaml:"username"`
	Password string `json:"password" yaml:"password"`

	ServiceName string `json:"service_name" yaml:"service_name"`

	BufferMaxCount int `json:"buffer_max_count" yaml:"buffer_max_count"`
}

type Logging added in v0.0.2

type Logging struct {
	Logger string `json:"logger" yaml:"logger"`
	Level  string `json:"level" yaml:"level"`
	Format string `json:"format" yaml:"format"`
}

func (*Logging) Bind added in v0.0.2

func (l *Logging) Bind() *Logging

type Meta

type Meta struct {
	Host                      string      `json:"host" yaml:"host"`
	Port                      int         `json:"port" yaml:"port"`
	Client                    *GRPCClient `json:"client" yaml:"client"`
	EnableCache               bool        `json:"enable_cache" yaml:"enable_cache"`
	CacheExpiration           string      `json:"cache_expiration" yaml:"cache_expiration"`
	ExpiredCacheCheckDuration string      `json:"expired_cache_check_duration" yaml:"expired_cache_check_duration"`
}

func (*Meta) Bind

func (m *Meta) Bind() *Meta

type Metrics added in v0.0.19

type Metrics struct {
	EnableVersionInfo bool `json:"enable_version_info" yaml:"enable_version_info"`
	EnableMemory      bool `json:"enable_memory" yaml:"enable_memory"`
	EnableGoroutine   bool `json:"enable_goroutine" yaml:"enable_goroutine"`
	EnableCGO         bool `json:"enable_cgo" yaml:"enable_cgo"`
}

type MySQL

type MySQL struct {
	DB                   string `json:"db" yaml:"db"`
	Host                 string `json:"host" yaml:"host"`
	Port                 int    `json:"port" yaml:"port"`
	User                 string `json:"user" yaml:"user"`
	Pass                 string `json:"pass" yaml:"pass"`
	Name                 string `json:"name" yaml:"name"`
	Charset              string `json:"charset" yaml:"charset"`
	Timezone             string `json:"timezone" yaml:"timezone"`
	InitialPingTimeLimit string `json:"initial_ping_time_limit" yaml:"initial_ping_time_limit"`
	InitialPingDuration  string `json:"initial_ping_duration" yaml:"initial_ping_duration"`
	ConnMaxLifeTime      string `json:"conn_max_life_time" yaml:"conn_max_life_time"`
	MaxOpenConns         int    `json:"max_open_conns" yaml:"max_open_conns"`
	MaxIdleConns         int    `json:"max_idle_conns" yaml:"max_idle_conns"`
	TLS                  *TLS   `json:"tls" yaml:"tls"`
	TCP                  *TCP   `json:"tcp" yaml:"tcp"`
}

func (*MySQL) Bind

func (m *MySQL) Bind() *MySQL

type NGT

type NGT struct {
	// IndexPath represent the ngt index file path
	IndexPath string `yaml:"index_path" json:"index_path"`

	// Dimension represent the ngt index dimension
	Dimension int `yaml:"dimension" json:"dimension"`

	// BulkInsertChunkSize represent the bulk insert chunk size
	BulkInsertChunkSize int `yaml:"bulk_insert_chunk_size" json:"bulk_insert_chunk_size"`

	// DistanceType represent the ngt index distance type
	DistanceType string `yaml:"distance_type" json:"distance_type"`

	// ObjectType represent the ngt index object type float or int
	ObjectType string `yaml:"object_type" json:"object_type"`

	// CreationEdgeSize represent the index edge count
	CreationEdgeSize int `yaml:"creation_edge_size" json:"creation_edge_size"`

	// SearchEdgeSize represent the search edge size
	SearchEdgeSize int `yaml:"search_edge_size" json:"search_edge_size"`

	AutoIndexLimit string `yaml:"auto_index_limit" json:"auto_index_limit"`

	// AutoIndexCheckDuration represent checking loop duration about auto indexing execution
	AutoIndexCheckDuration string `yaml:"auto_index_check_duration" json:"auto_index_check_duration"`

	// AutoIndexLength represent auto index length limit
	AutoIndexLength int `yaml:"auto_index_length" json:"auto_index_length"`

	// EnableInMemoryMode enables on memory ngt indexing mode
	EnableInMemoryMode bool `yaml:"enable_in_memory_mode" json:"enable_in_memory_mode"`
}

NGT represent the ngt core configuration for server.

func (*NGT) Bind

func (n *NGT) Bind() *NGT

type Observability added in v0.0.19

type Observability struct {
	Enabled    bool        `json:"enabled" yaml:"enabled"`
	Collector  *Collector  `json:"collector" yaml:"collector"`
	Trace      *Trace      `json:"trace" yaml:"trace"`
	Prometheus *Prometheus `json:"prometheus" yaml:"prometheus"`
	Jaeger     *Jaeger     `json:"jaeger" yaml:"jaeger"`
}

func (*Observability) Bind added in v0.0.19

func (o *Observability) Bind() *Observability

type PoolConfig

type PoolConfig struct {
	DataCenter               string `json:"data_center" yaml:"data_center"`
	DCAwareRouting           bool   `json:"dc_aware_routing" yaml:"dc_aware_routing"`
	NonLocalReplicasFallback bool   `json:"non_local_replicas_fallback" yaml:"non_local_replicas_fallback"`
	ShuffleReplicas          bool   `json:"shuffle_replicas" yaml:"shuffle_replicas"`
}

type Prometheus added in v0.0.19

type Prometheus struct {
	Enabled   bool   `json:"enabled" yaml:"enabled"`
	Endpoint  string `json:"endpoint" yaml:"endpoint"`
	Namespace string `json:"namespace" yaml:"namespace"`
}

type ReconnectionPolicy

type ReconnectionPolicy struct {
	MaxRetries      int    `json:"max_retries" yaml:"max_retries"`
	InitialInterval string `json:"initial_interval" yaml:"initial_interval"`
}

type Redis

type Redis struct {
	Addrs                []string `json:"addrs" yaml:"addrs"`
	DB                   int      `json:"db" yaml:"db"`
	DialTimeout          string   `json:"dial_timeout" yaml:"dial_timeout"`
	IdleCheckFrequency   string   `json:"idle_check_frequency" yaml:"idle_check_frequency"`
	IdleTimeout          string   `json:"idle_timeout" yaml:"idle_timeout"`
	InitialPingTimeLimit string   `json:"initial_ping_time_limit" yaml:"initial_ping_time_limit"`
	InitialPingDuration  string   `json:"initial_ping_duration" yaml:"initial_ping_duration"`
	KeyPref              string   `json:"key_pref" yaml:"key_pref"`
	MaxConnAge           string   `json:"max_conn_age" yaml:"max_conn_age"`
	MaxRedirects         int      `json:"max_redirects" yaml:"max_redirects"`
	MaxRetries           int      `json:"max_retries" yaml:"max_retries"`
	MaxRetryBackoff      string   `json:"max_retry_backoff" yaml:"max_retry_backoff"`
	MinIdleConns         int      `json:"min_idle_conns" yaml:"min_idle_conns"`
	MinRetryBackoff      string   `json:"min_retry_backoff" yaml:"min_retry_backoff"`
	Password             string   `json:"password" yaml:"password"`
	PoolSize             int      `json:"pool_size" yaml:"pool_size"`
	PoolTimeout          string   `json:"pool_timeout" yaml:"pool_timeout"`
	ReadOnly             bool     `json:"read_only" yaml:"read_only"`
	ReadTimeout          string   `json:"read_timeout" yaml:"read_timeout"`
	RouteByLatency       bool     `json:"route_by_latency" yaml:"route_by_latency"`
	RouteRandomly        bool     `json:"route_randomly" yaml:"route_randomly"`
	TLS                  *TLS     `json:"tls" yaml:"tls"`
	TCP                  *TCP     `json:"tcp" yaml:"tcp"`
	WriteTimeout         string   `json:"write_timeout" yaml:"write_timeout"`
	KVPrefix             string   `json:"kv_prefix" yaml:"kv_prefix"`
	VKPrefix             string   `json:"vk_prefix" yaml:"vk_prefix"`
	PrefixDelimiter      string   `json:"prefix_delimiter" yaml:"prefix_delimiter"`
}

func (*Redis) Bind

func (r *Redis) Bind() *Redis

type RetryPolicy

type RetryPolicy struct {
	NumRetries  int    `json:"num_retries" yaml:"num_retries"`
	MinDuration string `json:"min_duration" yaml:"min_duration"`
	MaxDuration string `json:"max_duration" yaml:"max_duration"`
}

type RoundTripper

type RoundTripper struct {
	TLSHandshakeTimeout   string `yaml:"tls_handshake_timeout" json:"tls_handshake_timeout"`
	MaxIdleConns          int    `yaml:"max_idle_conns" json:"max_idle_conns"`
	MaxIdleConnsPerHost   int    `yaml:"max_idle_conns_per_host" json:"max_idle_conns_per_host"`
	MaxConnsPerHost       int    `yaml:"max_conns_per_host" json:"max_conns_per_host"`
	IdleConnTimeout       string `yaml:"idle_conn_timeout" json:"idle_conn_timeout"`
	ResponseHeaderTimeout string `yaml:"response_header_timeout" json:"response_header_timeout"`
	ExpectContinueTimeout string `yaml:"expect_continue_timeout" json:"expect_continue_timeout"`
	MaxResponseHeaderSize int64  `yaml:"max_response_header_size" json:"max_response_header_size"`
	WriteBufferSize       int64  `yaml:"write_buffer_size" json:"write_buffer_size"`
	ReadBufferSize        int64  `yaml:"read_buffer_size" json:"read_buffer_size"`
	ForceAttemptHTTP2     bool   `yaml:"force_attempt_http_2" json:"force_attempt_http_2"`
}

func (*RoundTripper) Bind

func (r *RoundTripper) Bind() *RoundTripper

type Server

type Server struct {
	Name          string `json:"name" yaml:"name"`
	Host          string `json:"host" yaml:"host"`
	Port          uint   `json:"port" yaml:"port"`
	Mode          string `json:"mode" yaml:"mode"` // gRPC, REST, GraphQL
	ProbeWaitTime string `json:"probe_wait_time" yaml:"probe_wait_time"`
	HTTP          *HTTP  `json:"http" yaml:"http"`
	GRPC          *GRPC  `json:"grpc" yaml:"grpc"`
	Restart       bool   `json:"restart" yaml:"restart"`
}

func (*Server) Bind

func (s *Server) Bind() *Server

func (*Server) Opts

func (s *Server) Opts() []server.Option

type Servers

type Servers struct {
	// Server represent server configuration.
	Servers []*Server `json:"servers" yaml:"servers"`

	// HealthCheckServers represent health check server configuration
	HealthCheckServers []*Server `json:"health_check_servers" yaml:"health_check_servers"`

	// MetricsServers represent metrics exporter server such as prometheus or opentelemetly or golang's pprof server
	MetricsServers []*Server `json:"metrics_servers" yaml:"metrics_servers"`

	// StartUpStrategy represent starting order of server name
	StartUpStrategy []string `json:"startup_strategy" yaml:"startup_strategy"`
	// ShutdownStrategy represent shutdonw order of server name
	ShutdownStrategy []string `json:"shutdown_strategy" yaml:"shutdown_strategy"`

	// FullShutdownDuration represent summary duration of shutdown time
	FullShutdownDuration string `json:"full_shutdown_duration" yaml:"full_shutdown_duration"`

	// TLS represent server tls configuration.
	TLS *TLS `json:"tls" yaml:"tls"`
}

func (*Servers) Bind

func (s *Servers) Bind() *Servers

func (*Servers) GetGRPCStreamConcurrency added in v0.0.5

func (s *Servers) GetGRPCStreamConcurrency() (c int)

type TCP

type TCP struct {
	DNS    *DNS    `yaml:"dns" json:"dns"`
	Dialer *Dialer `yaml:"dialer" json:"dialer"`
	TLS    *TLS    `yaml:"tls" json:"tls"`
}

TCP represent the TCP configuration for server.

func (*TCP) Bind

func (t *TCP) Bind() *TCP

func (*TCP) Opts

func (t *TCP) Opts() []tcp.DialerOption

type TLS

type TLS struct {
	// Enable represent the server enable TLS or not.
	Enabled bool `yaml:"enabled" json:"enabled"`

	// Cert represent the certificate environment variable key used to start server.
	Cert string `yaml:"cert" json:"cert"`

	// Key represent the private key environment variable key used to start server.
	Key string `yaml:"key" json:"key"`

	// CA represent the CA certificate environment variable key used to start server.
	CA string `yaml:"ca" json:"ca"`
}

TLS represent the TLS configuration for server.

func (*TLS) Bind

func (t *TLS) Bind() *TLS

func (*TLS) Opts

func (t *TLS) Opts() []tls.Option

type Trace added in v0.0.19

type Trace struct {
	Enabled      bool    `json:"enabled" yaml:"enabled"`
	SamplingRate float64 `json:"sampling_rate" yaml:"sampling_rate"`
}

type Transport

type Transport struct {
	RoundTripper *RoundTripper `yaml:"round_tripper" json:"round_tripper"`
	Backoff      *Backoff      `yaml:"backoff" json:"backoff"`
}

TCP represent the TCP configuration for server.

func (*Transport) Bind

func (t *Transport) Bind() *Transport

Jump to

Keyboard shortcuts

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