package config

import "github.com/cloudflare/redoctober/config"

Package config implements configuration structures for Red October.

Index

Types

type Config

type Config struct {
	Server      *Server      `json:"server"`
	UI          *UI          `json:"ui"`
	HipChat     *HipChat     `json:"hipchat"`
	Metrics     *Metrics     `json:"metrics"`
	Reporting   *Reporting   `json:"reporting"`
	Delegations *Delegations `json:"delegations"`
}

Config contains all the configuration options for a redoctober instance.

func Load

func Load(path string) (*Config, error)

Load reads a JSON-encoded config file from disk.

func New

func New() *Config

New returns a new, empty config.

func (*Config) Valid

func (c *Config) Valid() bool

Valid ensures that the config has enough data to start a Red October process.

type Delegations

type Delegations struct {
	// Persist controls whether delegations are persisted or not.
	Persist bool `json:"persist"`

	// Policy contains the MSP predicate for delegation
	// persistence, and users contains the users allowed
	// to delegate.
	Policy string   `json:"policy"`
	Users  []string `json:"users"`

	// Mechanism specifies the persistence mechanism to use.
	Mechanism string `json:"mechanism"`

	// Location contains location information for the persistence
	// mechanism, such as a file path or database connection
	// string.
	Location string `json:"location"`
}

Delegations contains configuration for persisting delegations.

type HipChat

type HipChat struct {
	Host   string `json:"host"`
	Room   string `json:"room"`
	ID     string `json:"id"`
	APIKey string `json:"api_key"`
}

HipChat contains the settings for Hipchat integration. The ID is the name that should be used in the startup message.

func (*HipChat) Valid

func (hc *HipChat) Valid() bool

Valid returns true if the HipChat config is ready to be used for HipChat notifications.

type Metrics

type Metrics struct {
	Host string `json:"host"`
	Port string `json:"port"`
}

Metrics contains the configuration for the Prometheus metrics collector.

type Reporting

type Reporting struct {
	SentryDSN string `json:"sentry_dsn"`
}

Reporting contains configuration for error reporting.

type Server

type Server struct {
	// Addr contains the host:port that the server should listen
	// on.
	Addr string `json:"address"`

	// CAPath contains the path to the TLS CA for client
	// authentication. This is an optional field.
	CAPath string `json:"ca_path,omitempty"`

	// KeyPaths and CertPaths contains a list of paths to TLS key
	// pairs that should be used to secure connections to the
	// server. The paths should be comma-separated.
	KeyPaths  string `json:"private_keys"`
	CertPaths string `json:"certificates"`

	// Systemd indicates whether systemd socket activation should
	// be used instead of a normal port listener.
	Systemd bool `json:"use_systemd,omitempty"`
}

Server contains the configuration information required to start a redoctober server.

type UI

type UI struct {
	// Root contains the base URL for the UI.
	Root string `json:"root"`

	// Static is an optional path for overriding the built in HTML
	// UI.
	Static string `json:"static"`
}

UI contains the configuration information for the WWW API.

Source Files

config.go

Version
v0.0.0-20241112165158-ce2ad370627b (latest)
Published
Nov 12, 2024
Platform
linux/amd64
Imports
2 packages
Last checked
1 day ago

Tools for package owners.