config

package
v0.0.0-...-deb1d55 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2023 License: BSD-2-Clause Imports: 2 Imported by: 19

Documentation

Overview

Package config implements configuration structures for Red October.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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.

Jump to

Keyboard shortcuts

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