configuration

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2022 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Component

type Component struct {
	// Unique but user-readable component name
	Name        string `validate:"required"`
	Description string
	// If the component should be hidden to users while operational
	OnlyShowIfDegraded bool
	// If uptime data should be hidden and go unrecorded
	HideUptime bool
	// Date the component existed from, in the form YYYY-MM-DD
	StartDate string `validate:"required"`
}

Component configuration--note that leaving any of the below unfilled will use Go's "zero" value (false/empty)

type ComponentGroup added in v0.2.1

type ComponentGroup struct {
	// Unique but user-readable group name
	Name        string `validate:"required"`
	Description string
	// Exact names of components to include in the group (components should never exist in more than one group)
	ComponentNames []string `validate:"required,unique"`
}

ComponentGroup configuration--note that leaving any of the below unfilled will use Go's "zero" value (false/empty)

type Config

type Config struct {
	// Whether to be more verbose with console output
	// NOTE: May be set via --verbose / -v command line flags
	Verbose bool

	Client struct {
		// Number of 300-series redirects to follow
		Redirects int // default: 3
		// Number of exponential-backoff retries to make
		Retries int // default: 3
	}

	Statuspage struct {
		// API key to communicate with Statuspage.io
		// NOTE: May be set via REVERE_STATUSPAGE_APIKEY in environment
		ApiKey string `validate:"required"`
		// ID of the particular page to interact with
		PageID     string           `validate:"required"`
		ApiRoot    string           // default: "https://api.statuspage.io/v1"
		Components []Component      `validate:"unique=Name,dive"`
		Groups     []ComponentGroup `validate:"unique=Name,dive"`
	}

	Pubsub struct {
		// Non-numeric ID of the GCP project containing the subscription
		ProjectID string `validate:"required"`
		// ID of the Cloud Pub/Sub subscription to use to pull messages
		SubscriptionID string `validate:"required"`
	}

	Api struct {
		// Port to host Revere's web server on
		// NOTE: May be set via REVERE_API_PORT in environment
		Port int // default: 8080
		// Print debugging information from the server library
		Debug bool
		// Forcibly silence the request log
		Silent bool
	}

	// Correlate developed services to user-facing components
	ServiceToComponentMapping []ServiceToComponentMapping `validate:"dive"`
}

Config schema

All values:

  • may be set in revere.yaml, see cmd/root.go: ```yaml client: redirects: 2 ```

Some values: - may be overridden via command line flags, noted below. - may be overridden via environment variables, noted below and set in readEnvironmentVariables(). - may have non-"zero" default values, noted below and set in newDefaultConfig(). - may be required to be non-"zero", noted below and validated in AssembleConfig().

func AssembleConfig

func AssembleConfig(v *viper.Viper) (*Config, error)

AssembleConfig creates a default config, reads values from Viper's config file, reads applies overrides from the environment, and validates the config before returning

type ServiceToComponentMapping added in v0.2.9

type ServiceToComponentMapping struct {
	ServiceName            string   `validate:"required"`
	ServiceEnvironment     string   `validate:"required"`
	AffectsComponentsNamed []string `validate:"unique"`
}

ServiceToComponentMapping correlates developed services ("Rawls", "Leonardo") in particular environments ("prod") to user-facing components ("Notebooks", "Terra UI")

Jump to

Keyboard shortcuts

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