config

package
v0.0.0-...-fcfa923 Latest Latest
Warning

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

Go to latest
Published: May 19, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AlerterPreferences

type AlerterPreferences struct {
	// DelegationAlerts which takes an option to disable/enable balance delegation alerts, on enable sends alert when current
	// account balance has dropped below from previous account balance.
	DelegationAlerts string `mapstructure:"delegation_alerts"`
	// AccountBalanceChangeAlerts which takes an option to disable/enable Account balance change alerts, on enable sends alert
	// when balance has dropped to balance threshold
	AccountBalanceChangeAlerts string `mapstructure:"account_balance_change_alerts"`
	// BlockDiffAlerts which takes an option to enable/disable block height difference alerts, on enable sends alert
	// when difference meets or exceeds block difference threshold
	BlockDiffAlerts string `mapstructure:"block_diff_alerts"`
	// NodeHealthAlert which takes an option to  enable/disable node Health status alert, on enable sends alerts
	NodeHealthAlert string `mapstructure:"node_health_alert"`
	// EpochDiffAlerts which takes an option to enable/disable epoch difference alerts, on enable sends alerts if
	// difference reaches or exceeds epoch difference threshold
	EpochDiffAlerts string `mapstructure:"epoch_diff_alrets"`
	// SkipRateAlerts which takes an option to enable/disable skip rate alerts, on enable sends alerts if validator skip rate
	// exceeds network skip rate
	SkipRateAlerts string `mapstructure:"skip_rate_alerts"`
}

AlerterPreferences which holds individual alert settings which takes an option to enable/disable particular alert

type AlertingThreshold

type AlertingThreshold struct {
	// BlockDiffThreshold is to send alerts when the difference b/w network and validator's
	// block height reaches or exceedes to block difference threshold
	BlockDiffThreshold int64 `mapstructure:"block_diff_threshold"`
	// BalanaceChangeThreshold is to send alert when the validator balance has dropped below to this threshold
	BalanaceChangeThreshold float64 `mapstructure:"balance_change_threshold"`
	// EpochDiffThreahold option is to send alerts when the difference b/w network and validator's
	// epoch reaches or exceedes to epoch difference threshold
	EpochDiffThreshold int64 `mapstructure:"epoch_diff_threshold"`
	// SkipRateThreshold is to send alerts when the skip rate exceeds the configured threshold
	SkipRateThreshold int64 `mapstructure:"skip_rate_threshold"`
}

AlertingThreshold defines threshold condition for different alert-cases. `Alerter` will send alerts if the condition reaches the threshold

type Config

type Config struct {
	Endpoints           Endpoints           `mapstructure:"rpc_and_lcd_endpoints"`
	ValDetails          ValDetails          `mapstructure:"validator_details"`
	EnableAlerts        EnableAlerts        `mapstructure:"enable_alerts"`
	RegularStatusAlerts RegularStatusAlerts `mapstructure:"regular_status_alerts"`
	AlerterPreferences  AlerterPreferences  `mapstructure:"alerter_preferences"`
	AlertingThresholds  AlertingThreshold   `mapstructure:"alerting_threholds"`
	Scraper             Scraper             `mapstructure:"scraper"`
	Telegram            Telegram            `mapstructure:"telegram"`
	SendGrid            SendGrid            `mapstructure:"sendgrid"`
	Prometheus          Prometheus          `mapstructure:"prometheus"`
}

Config defines all the configurations required for the app

func ReadFromFile

func ReadFromFile() (*Config, error)

ReadFromFile to read config details using viper

func (*Config) Validate

func (c *Config) Validate(e ...string) error

Validate config struct

type EnableAlerts

type EnableAlerts struct {
	// EnableTelegramAlerts which takes an option to enable/disable telegram alerts
	EnableTelegramAlerts bool `mapstructure:"enable_telegram_alerts"`
	// EnableTelegramAlerts which takes an option to enable/disable emial alerts
	EnableEmailAlerts bool `mapstructure:"enable_email_alerts"`
}

EnableAlerts struct which holds options to enalbe/disable alerts

type Endpoints

type Endpoints struct {
	// RPCEndPoint is used to gather information about validator status,active stake, account balance, commission rate and etc.
	RPCEndpoint string `mapstructure:"rpc_endpoint"`
	// NetworkRPC is used to gather information about validator
	NetworkRPC string `mapstructure:"network_rpc"`
}

Endpoints defines multiple API base-urls to fetch the data

type Prometheus

type Prometheus struct {
	// ListenAddress to export metrics on the given port
	ListenAddress string `mapstructure:"listen_address"`
	// PrometheusAddress to connect to prormetheus where it has running
	PrometheusAddress string `mapstructure:"prometheus_address"`
}

Prometheus stores Prometheus details

type RegularStatusAlerts

type RegularStatusAlerts struct {
	// AlertTimings is the array of time slots to send validator status alerts at that particular timings
	AlertTimings []string `mapstructure:"alert_timings"`
}

RegularStatusAlerts defines time-slots to receive validator status alerts

type Scraper

type Scraper struct {
	// Rate is to call and get the data for specified targets on that particular time interval
	Rate string `mapstructure:"rate"`
}

Scraper defines the time intervals for multiple scrapers to fetch the data

type SendGrid

type SendGrid struct {
	// Token of sendgrid account
	Token string `mapstructure:"sendgrid_token"`
	// ToEmailAddress is the email to which all the alerts will be sent
	ReceiverEmailAddress string `mapstructure:"receiver_email_address"`
	// SendgridEmail is the email of sendgrid account which will be used to send mail alerts
	SendgridEmail string `mapstructure:"account_email"`
	// SendgridName is the name of sendgrid account which will be used to send mail alerts
	SendgridName string `mapstructure:"sendgrid_account_name"`
}

SendGrid stores sendgrid API credentials

type Telegram

type Telegram struct {
	// BotToken is the token of your telegram bot
	BotToken string `mapstructure:"tg_bot_token"`
	// ChatID is the id of telegarm chat which will be used to get alerts
	ChatID int64 `mapstructure:"tg_chat_id"`
}

Telegram bot details struct

type ValDetails

type ValDetails struct {
	// ValidatorName is the moniker of your validator which will be used to display in alerts messages
	ValidatorName string `mapstructure:"validator_name"`
	// PubKey of validator as base-58 encoded string
	PubKey string `mapstructure:"pub_key"`
	// VoteKey of validator as base-58 encoded string
	VoteKey string `mapstructure:"vote_key"`
}

ValDetails stores the validator meta details

Jump to

Keyboard shortcuts

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