config

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2023 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AWSConfig

type AWSConfig struct {
	Enabled bool   `default:"false"`
	Region  string `split_words:"true"`
	Bucket  string `split_words:"true"`
}

func (AWSConfig) Validate

func (c AWSConfig) Validate() (err error)

Validate the AWS config.

type Config

type Config struct {
	LogLevel     logger.LevelDecoder `split_words:"true" default:"info"`
	ConsoleLog   bool                `split_words:"true" default:"false"`
	CloseTimeout time.Duration       `split_words:"true" default:"30s"`
	FeedSync     FeedSyncConfig      `split_words:"true"`
	PostFetch    PostFetchConfig     `split_words:"true"`
	Monitoring   MonitoringConfig
	Publisher    PublisherConfig
	Subscriber   SubscriberConfig
	// contains filtered or unexported fields
}

Config contains all of the configuration parameters for an Baleen service and is loaded from the environment or a configuration file with reasonable defaults for values that are omitted. The Config should be validated in preparation for running Baleen to ensure that all eventing operations work as expected. TODO: collect the config from a file instead of the environment.

func New

func New() (_ Config, err error)

New creates a new Config object, loading environment variables and defaults.

func (Config) GetLogLevel

func (c Config) GetLogLevel() zerolog.Level

Parse and return the zerolog log level for configuring global logging.

func (Config) IsZero

func (c Config) IsZero() bool

A Config is zero-valued if it hasn't been processed by a file or the environment.

func (Config) Mark

func (c Config) Mark() (Config, error)

Mark a manually constructed config as processed as long as its valid.

func (Config) RouterConfig

func (c Config) RouterConfig() message.RouterConfig

Returns the Watermill RouterConfig=

func (Config) Validate

func (c Config) Validate() (err error)

Validate the entire config.

type EnsignConfig

type EnsignConfig struct {
	Enabled      bool   `default:"false"`
	Endpoint     string `default:"flagship.rotational.dev:443"`
	ClientID     string `split_words:"true"`
	ClientSecret string `split_words:"true"`
	Insecure     bool   `default:"false"`
}

type FeedSyncConfig

type FeedSyncConfig struct {
	Enabled  bool          `default:"false"`
	Interval time.Duration `default:"1h"`
}

type KafkaConfig

type KafkaConfig struct {
	Enabled        bool   `default:"false"`
	URL            string `split_words:"true"`
	Balancer       string `default:"LeastBytes"`
	TopicDocuments string `default:"documents"`
	TopicFeeds     string `default:"feeds"`
}

func (KafkaConfig) Validate

func (c KafkaConfig) Validate() (err error)

Validate the Kafka config.

type MonitoringConfig

type MonitoringConfig struct {
	Enabled  bool   `default:"true"`
	BindAddr string `split_words:"true" default:":1205"`
	NodeID   string `split_words:"true" required:"false"`
}

MonitoringConfig maintains the parameters for the metrics server that the Prometheus scraper will fetch the configured observability metrics from.

type PostFetchConfig

type PostFetchConfig struct {
	Enabled bool `default:"false"`
}

type PublisherConfig

type PublisherConfig struct {
	Ensign EnsignConfig
	Kafka  KafkaConfig
}

Publisher Config defines the type of configuration to connect to the publisher with.

func (PublisherConfig) Validate

func (c PublisherConfig) Validate() error

type SubscriberConfig

type SubscriberConfig struct {
	Ensign EnsignConfig
	Kafka  KafkaConfig
}

Subscriber Config defines the type of configuration to connect to the publisher with.

func (SubscriberConfig) Validate

func (c SubscriberConfig) Validate() error

Jump to

Keyboard shortcuts

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