config

package
v1.2.88 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2024 License: MIT Imports: 6 Imported by: 4

Documentation

Index

Constants

View Source
const (
	CfgLoglevel               = "LOG_LEVEL"
	CfgHttpReadTimeoutMs      = "HTTP_READ_TIMEOUT_MS"
	CfgHttpWriteTimeoutMs     = "HTTP_WRITE_TIMEOUT_MS"
	CfgWsKeepAliveSec         = "WS_KEEP_ALIVE_SEC"
	CfgWsReadBufferSizeBytes  = "WS_READ_BUFFER_SIZE_BYTES"
	CfgWsWriteBufferSizeBytes = "WS_WRITE_BUFFER_SIZE_BYTES"
	CfgWsWriteCompress        = "WS_WRITE_COMPRESS"
	CfgWsWriteTimeoutSec      = "WS_WRITE_TIMEOUT"
	CfgWsPongTimeoutSec       = "WS_PONG_TIMEOUT"
	CfgTopicPartitions        = "TOPIC_PARTITIONS"

	CfgEnableGoRuntimeProfiler = "ENABLE_GO_RUNTIME_PROFILER"
	CfgGoRuntimeProfilerAddr   = "GO_RUNTIME_PROFILER_ADDR"

	// CfgEnableMessageOrdering is set to true to ensure that messages with the same ordering key are delivered in the order they were published.
	// This is crucial for use cases where the order of messages is important for correct processing.
	// Note: The Pub/Sub topic must be configured to support message ordering for this to take effect.
	// Enabling message ordering may impact the throughput of message publishing, as it requires Pub/Sub to maintain order within each ordering key.
	CfgEnableMessageOrdering = "ENABLE_MESSAGE_ORDERING"

	// CfgPubSubNumOfGoroutines NumGoroutines specifies the number of goroutines that will be used
	// to pull messages from the subscription in parallel. Each goroutine
	// opens a separate StreamingPull stream. A higher number of goroutines
	// might increase throughput but also increases the system's load.
	// Defaults to DefaultReceiveSettings.NumGoroutines when set to 0.
	CfgPubSubNumOfGoroutines = "PUBSUB_NUM_OF_GOROUTINES"

	// CfgPubSubMaxOutstandingMessages defines the maximum number of unprocessed
	// messages (messages that have been received but not yet acknowledged
	// or expired). Setting this to a lower number can prevent the consumer
	// from being overwhelmed by a large volume of incoming messages.
	// If set to 0, the default is DefaultReceiveSettings.MaxOutstandingMessages.
	// A negative value indicates no limit.
	CfgPubSubMaxOutstandingMessages = "PUBSUB_MAX_OUTSTANDING_MESSAGES"

	// CfgPubSubMaxOutstandingBytes is the maximum total size of unprocessed messages.
	// This setting helps to control memory usage by limiting the total size
	// of messages that can be held in memory at a time. If set to 0, the
	// default is DefaultReceiveSettings.MaxOutstandingBytes. A negative
	// value indicates no limit on the byte size of unprocessed messages.
	CfgPubSubMaxOutstandingBytes = "PUSUB_MAX_OUTSTANDING_BYTES"

	// CfgGcpProject specifies GCP project name
	CfgGcpProject = "GCP_PROJECT"
	// CfgGcpRegion specifies GCP region
	CfgGcpRegion = "GCP_REGION"
	// CfgGcpZone specifies GCP zone
	CfgGcpZone = "GCP_ZONE"

	CfgPubSubLiteUri = "PUBSUB_LITE_URI"
)
View Source
const (
	DefaultPubSubNumOfGoroutines = 0
	DefaultPubSubMaxOutstandingMessages
	DefaultPubSubMaxOutstandingBytes = 0
	DefaultEnableMessageOrdering     = false
	DefaultEnableGoRuntimeProfiler   = false
	DefaultGoRuntimeProfilerAddr     = ":6060"

	DefaultGcpProject = "shieldiot-staging"
	DefaultGcpRegion  = "europe-west3"
	DefaultGcpZone    = "europe-west3-a"

	DefaultPubSubLiteUri = "pubsub://shieldiot-staging/europe-west3-a"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseConfig

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

func Get

func Get() *BaseConfig

Get singleton instance

func (*BaseConfig) AddConfigVar added in v1.1.2

func (c *BaseConfig) AddConfigVar(key, value string)

AddConfigVar adds or updates configuration variable

func (*BaseConfig) EnableGoRuntimeProfiler added in v1.2.84

func (c *BaseConfig) EnableGoRuntimeProfiler() bool

func (*BaseConfig) EnableMessageOrdering added in v1.2.83

func (c *BaseConfig) EnableMessageOrdering() bool

func (*BaseConfig) GcpProject added in v1.2.87

func (c *BaseConfig) GcpProject() string

func (*BaseConfig) GcpRegion added in v1.2.87

func (c *BaseConfig) GcpRegion() string

func (*BaseConfig) GcpZone added in v1.2.87

func (c *BaseConfig) GcpZone() string

func (*BaseConfig) GetAllKeysSorted

func (c *BaseConfig) GetAllKeysSorted() []string

GetAllKeysSorted gets a list of all the configuration keys

func (*BaseConfig) GetAllVars

func (c *BaseConfig) GetAllVars() map[string]string

GetAllVars gets a map of all the configuration variables and values

func (*BaseConfig) GetBoolParamValueOrDefault

func (c *BaseConfig) GetBoolParamValueOrDefault(key string, defaultValue bool) (val bool)

GetBoolParamValueOrDefault gets environment variable as bool

func (*BaseConfig) GetInt64ParamValueOrDefault

func (c *BaseConfig) GetInt64ParamValueOrDefault(key string, defaultValue int64) (val int64)

GetInt64ParamValueOrDefault gets environment variable as int64

func (*BaseConfig) GetIntParamValueOrDefault

func (c *BaseConfig) GetIntParamValueOrDefault(key string, defaultValue int) (val int)

GetIntParamValueOrDefault gets environment variable as int

func (*BaseConfig) GetStringParamValueOrDefault

func (c *BaseConfig) GetStringParamValueOrDefault(key string, defaultValue string) (val string)

GetStringParamValueOrDefault gets environment variable as string

func (*BaseConfig) GoRuntimeProfilerAddr added in v1.2.84

func (c *BaseConfig) GoRuntimeProfilerAddr() string

func (*BaseConfig) HttpReadTimeoutMs

func (c *BaseConfig) HttpReadTimeoutMs() int

HttpReadTimeoutMs gets HTTP read time out in milliseconds

func (*BaseConfig) HttpWriteTimeoutMs

func (c *BaseConfig) HttpWriteTimeoutMs() int

HttpWriteTimeoutMs gets HTTP write time out in milliseconds

func (*BaseConfig) LogLevel

func (c *BaseConfig) LogLevel() string

LogLevel gets log level

func (*BaseConfig) PubSubLiteUri added in v1.2.88

func (c *BaseConfig) PubSubLiteUri() string

func (*BaseConfig) PubSubMaxOutstandingBytes added in v1.2.81

func (c *BaseConfig) PubSubMaxOutstandingBytes() int

func (*BaseConfig) PubSubMaxOutstandingMessages added in v1.2.81

func (c *BaseConfig) PubSubMaxOutstandingMessages() int

func (*BaseConfig) PubSubNumOfGoroutines added in v1.2.81

func (c *BaseConfig) PubSubNumOfGoroutines() int

func (*BaseConfig) ScanEnvVariables

func (c *BaseConfig) ScanEnvVariables()

ScanEnvVariables scans all environment variables and map their values to existing configuration keys

func (*BaseConfig) TopicPartitions added in v1.2.16

func (c *BaseConfig) TopicPartitions() int

TopicPartitions gets default number of partitions per topic

func (*BaseConfig) WsKeepALiveInterval

func (c *BaseConfig) WsKeepALiveInterval() int64

WsKeepALiveInterval gets web socket keep alive interval (in seconds)

func (*BaseConfig) WsPongTimeoutSec

func (c *BaseConfig) WsPongTimeoutSec() int

WsPongTimeoutSec gets web socket PONG time out in seconds

func (*BaseConfig) WsReadBufferSizeBytes

func (c *BaseConfig) WsReadBufferSizeBytes() int

WsReadBufferSizeBytes gets web socket read buffer size

func (*BaseConfig) WsWriteBufferSizeBytes

func (c *BaseConfig) WsWriteBufferSizeBytes() int

WsWriteBufferSizeBytes gets web socket write buffer size

func (*BaseConfig) WsWriteCompress

func (c *BaseConfig) WsWriteCompress() bool

WsWriteCompress gets web socket compression on write flag

func (*BaseConfig) WsWriteTimeoutSec

func (c *BaseConfig) WsWriteTimeoutSec() int

WsWriteTimeoutSec gets web socket write time out in seconds

Jump to

Keyboard shortcuts

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