env

package
v1.1.18 Latest Latest
Warning

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

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

Documentation

Overview

Package env contains functions for working with environment configuration (capidaemon.json, capitoolbelt.json, capiwebapi.json)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AmqpConfig

type AmqpConfig struct {
	URL           string `json:"url"`
	Exchange      string `json:"exchange"`
	PrefetchCount int    `json:"prefetch_count"`
	PrefetchSize  int    `json:"prefetch_size"`
}

type CassandraConfig

type CassandraConfig struct {
	Hosts                     []string    `json:"hosts"`
	Port                      int         `json:"port"`
	Username                  string      `json:"username"`
	Password                  string      `json:"password"`
	WriterWorkers             int         `json:"writer_workers"`              // 20 is conservative, 80 is very aggressive
	MinInserterRate           int         `json:"min_inserter_rate"`           // writes/sec; if the rate falls below this, we consider the db too slow and throw an error
	NumConns                  int         `json:"num_conns"`                   // gocql default is 2, don't make it too high
	Timeout                   int         `json:"timeout"`                     // in ms, set it to 5s, gocql default 600ms is way too aggressive for heavy writes by multiple workers
	ConnectTimeout            int         `json:"connect_timeout"`             // in ms, set it to 1s, gocql default 600ms may be ok, but let's stay on the safe side
	KeyspaceReplicationConfig string      `json:"keyspace_replication_config"` // { 'class' : 'NetworkTopologyStrategy', 'datacenter1' : 1 }
	SslOpts                   *SslOptions `json:"ssl_opts"`
}

type EnvConfig

type EnvConfig struct {
	HandlerExecutableType             string                     `json:"handler_executable_type"`
	Cassandra                         CassandraConfig            `json:"cassandra"`
	Amqp                              AmqpConfig                 `json:"amqp"`
	ZapConfig                         zap.Config                 `json:"zap_config"`
	ThreadPoolSize                    int                        `json:"thread_pool_size"`
	DeadLetterTtl                     int                        `json:"dead_letter_ttl"`
	CaPath                            string                     `json:"ca_path"`
	PrivateKeys                       map[string]string          `json:"private_keys"`
	Webapi                            WebapiConfig               `json:"webapi,omitempty"`
	CustomProcessorsSettings          map[string]json.RawMessage `json:"custom_processors"`
	CustomProcessorDefFactoryInstance sc.CustomProcessorDefFactory
}

func ReadEnvConfigFile

func ReadEnvConfigFile(envConfigFile string) (*EnvConfig, error)

func (*EnvConfig) Deserialize

func (ec *EnvConfig) Deserialize(jsonBytes []byte) error

type SslOptions

type SslOptions struct {
	CertPath               string `json:"cert_path"`
	KeyPath                string `json:"key_path"`
	CaPath                 string `json:"ca_path"`
	EnableHostVerification bool   `json:"enable_host_verification"`
}

This was not tested outside of the EnableHostVerification=false scenario

type WebapiConfig added in v1.1.0

type WebapiConfig struct {
	Port                     int    `json:"webapi_port"`
	AccessControlAllowOrigin string `json:"access_control_allow_origin"`
}

Jump to

Keyboard shortcuts

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