configs

package
v0.0.0-...-165bc0d Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const CTXKEY ctxkey = "events.configs"

Variables

This section is empty.

Functions

func WithContext

func WithContext(ctx context.Context, cfg *Configs) context.Context

Types

type Configs

type Configs struct {
	*xconfig.Configs
	BucketTemplate string `json:"bucket_template" mapstructure:"SCRAPSTREAM_EVENTS_BUCKET_TEMPLATE"`

	Metrics   *xmetricsconfigs.Configs
	GRPC      *xrpc.Configs
	Datastore *datastore.Configs
	MsgBus    *msgbusconfigs.Configs
}

func FromContext

func FromContext(ctx context.Context) (*Configs, error)

func New

func New(provider *viper.Viper) (*Configs, error)

func (*Configs) ToString

func (cfg *Configs) ToString() string

type Datastore

type Datastore struct {
	Hosts    []string `json:"hosts" mapstructure:"SCRAPSTREAM_EVENTS_DATASTORE_HOSTS"`
	Keyspace string   `json:"keyspace" mapstructure:"SCRAPSTREAM_EVENTS_DATASTORE_KEYSPACE"`
	Table    string   `json:"table" mapstructure:"SCRAPSTREAM_EVENTS_DATASTORE_TABLE"`
}

type GRPC

type GRPC struct {
	ServerListenAddress       string  `json:"server_listen_address" mapstructure:"SCRAPSTREAM_EVENTS_GRPC_SERVER_LISTEN_ADDRESS"`
	ServerCertsDir            string  `json:"server_certs_dir" mapstructure:"SCRAPSTREAM_EVENTS_GRPC_SERVER_CERTS_DIR"`
	ClientRemoteAddress       string  `json:"client_remote_address" mapstructure:"SCRAPSTREAM_EVENTS_GRPC_CLIENT_REMOTE_ADDRESS"`
	ClientCertFile            string  `json:"client_cert_file" mapstructure:"SCRAPSTREAM_EVENTS_GRPC_CLIENT_CERT_FILE"`
	ClientRetryMax            uint    `json:"client_retry_max" mapstructure:"SCRAPSTREAM_EVENTS_GRPC_CLIENT_RETRY_MAX"`
	ClientBreakerFailureRatio float64 `json:"client_breaker_failure_ratio" mapstructure:"SCRAPSTREAM_EVENTS_GRPC_CLIENT_BREAKER_FAILURE_RATIO"`
}

type Metrics

type Metrics struct {
	Name                    string `json:"name" mapstructure:"SCRAPSTREAM_EVENTS_METRICS_NAME"`
	Provider                string `json:"provider" mapstructure:"SCRAPSTREAM_EVENTS_METRICS_PROVIDER"`
	HTTPServerListenAddress string `json:"http_server_listen_address" mapstructure:"SCRAPSTREAM_EVENTS_METRICS_HTTP_SERVER_LISTEN_ADDRESS"`
}

type MsgBus

type MsgBus struct {
	Uri    string `json:"uri" mapstructure:"SCRAPSTREAM_EVENTS_MSGBUS_NATS_URI"`
	Region string `json:"region" mapstructure:"SCRAPSTREAM_EVENTS_MSGBUS_NATS_NAME"`
	Name   string `json:"name" mapstructure:"SCRAPSTREAM_EVENTS_MSGBUS_NATS_REGION"`
	Topic  string `json:"topic" mapstructure:"SCRAPSTREAM_EVENTS_MSGBUS_NATS_TOPIC"`

	MaxMsgs         int64 `json:"max_msg" mapstructure:"SCRAPSTREAM_EVENTS_MSGBUS_NATS_MAX_MSG"`
	MaxBytes        int64 `json:"max_bytes" mapstructure:"SCRAPSTREAM_EVENTS_MSGBUS_NATS_MAX_BYTES"`
	MaxAgeInMinutes int32 `json:"max_age" mapstructure:"SCRAPSTREAM_EVENTS_MSGBUS_NATS_MAX_AGE_IN_MINUTES"`
	ConsumerPolicy  int   `json:"consumer_policy" mapstructure:"SCRAPSTREAM_EVENTS_MSGBUS_NATS_CONSUMER_POLICY"`

	MaxRetry             int `json:"max_retry" mapstructure:"SCRAPSTREAM_EVENTS_MSGBUS_NATS_MAX_RETRY"`
	MaxRetryDelaySeconds int `json:"max_retry_delay_seconds" mapstructure:"SCRAPSTREAM_EVENTS_MSGBUS_NATS_MAX_RETRY_DELAY_SECONDS"`
}

Jump to

Keyboard shortcuts

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