config

package
v0.0.0-...-996fa4a Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2024 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ChannelSeparator = '/' // The separator character.

)

Constants used throughout the service.

Variables

View Source
var LoadProvider = cfg.LoadProvider

LoadProvider loads a provider from the configuration or panics if the configuration is specified, but the provider was not found or not able to configure. This uses the first provider as a default value.

VaultUser is the vault user to use for authentication

Functions

func NewDefault

func NewDefault() cfg.Config

NewDefault creates a default configuration.

Types

type ClusterConfig

type ClusterConfig struct {

	// The name of this node. This must be unique in the cluster. If this is not set, Emitter
	// will set it to the external IP address of the running machine.
	NodeName string `json:"name,omitempty"`

	// The IP address and port that is used to bind the inter-node communication network. This
	// is used for the actual binding of the port.
	ListenAddr string `json:"listen"`

	// The address and port to advertise inter-node communication network. This is used for nat
	// traversal.
	AdvertiseAddr string `json:"advertise"`

	// The seed address (or a domain name) for cluster join.
	Seed string `json:"seed,omitempty"`

	// Passphrase is used to initialize the primary encryption key in a keyring. This key
	// is used for encrypting all the gossip messages (message-level encryption).
	Passphrase string `json:"passphrase,omitempty"`

	// Directory specifies the directory where the cluster state will be stored.
	Directory string `json:"dir,omitempty"`
}

ClusterConfig represents the configuration for the cluster.

type Config

type Config struct {
	ListenAddr string              `json:"listen"`             // The API port used for TCP & Websocket communication.
	License    string              `json:"license"`            // The license file to use for the broker.
	Matcher    string              `json:"matcher,omitempty"`  // If "mqtt", then topic matching would follow MQTT specification.
	Debug      bool                `json:"debug,omitempty"`    // The debug mode flag.
	Limit      LimitConfig         `json:"limit,omitempty"`    // Configuration for various limits such as message size.
	TLS        *cfg.TLSConfig      `json:"tls,omitempty"`      // The API port used for Secure TCP & Websocket communication.
	Cluster    *ClusterConfig      `json:"cluster,omitempty"`  // The configuration for the clustering.
	Storage    *cfg.ProviderConfig `json:"storage,omitempty"`  // The configuration for the storage provider.
	Contract   *cfg.ProviderConfig `json:"contract,omitempty"` // The configuration for the contract provider.
	Metering   *cfg.ProviderConfig `json:"metering,omitempty"` // The configuration for the usage storage for metering.
	Logging    *cfg.ProviderConfig `json:"logging,omitempty"`  // The configuration for the logger.
	Monitor    *cfg.ProviderConfig `json:"monitor,omitempty"`  // The configuration for the monitoring storage.
	Vault      secretStoreConfig   `json:"vault,omitempty"`    // The configuration for the Hashicorp Vault Secret Store.
	Dynamo     secretStoreConfig   `json:"dynamodb,omitempty"` // The configuration for the AWS DynamoDB Secret Store.
	// contains filtered or unexported fields
}

Config represents main configuration.

func New

func New(filename string, stores ...cfg.SecretStore) *Config

New reads or creates a configuration.

func (*Config) Addr

func (c *Config) Addr() *net.TCPAddr

Addr returns the listen address configured.

func (*Config) Certificate

func (c *Config) Certificate() (*tls.Config, http.Handler, bool)

Certificate returns TLS configuration.

func (*Config) MaxMessageBytes

func (c *Config) MaxMessageBytes() int64

MaxMessageBytes returns the configured max message size, must be smaller than 64K.

type LimitConfig

type LimitConfig struct {

	// Maximum message size allowed from/to the client. Default if not specified is 64kB.
	MessageSize int `json:"messageSize,omitempty"`

	// The maximum messages per second allowed to be processed per client connection. This
	// effectively restricts the QpS for an individual connection.
	ReadRate int `json:"readRate,omitempty"`

	// The maximum socket write rate per connection. This does not limit QpS but instead
	// can be used to scale throughput. Defaults to 60.
	FlushRate int `json:"flushRate,omitempty"`
}

LimitConfig represents various limit configurations - such as message size.

Jump to

Keyboard shortcuts

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