config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: AGPL-3.0 Imports: 15 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package config reads the bootstrap settings of C-02.FR-1 and FR-2 from the environment (ADR-0010): only MUSTER_* variables, read with caarlos0/env and checked with go-playground/validator. A secret can also come from its *_FILE variable. An invalid or missing value is an error that names the variable; nothing falls back silently, and an error never carries a secret.

Index

Constants

View Source
const (
	DefaultDatabasePort    = "5432"
	DefaultDatabaseSSLMode = "prefer"
	DefaultListenApp       = ":8080"
	DefaultListenIngest    = ":8081"
	DefaultListenInternal  = ":8082"
	DefaultLogLevel        = "info"
	DefaultRunbookBaseURL  = "https://muster-io.github.io/muster"
)

The defaults of defaults.md: a variable that is not set takes its default; one that is set, even empty, does not.

Variables

This section is empty.

Functions

func SecureContext

func SecureContext(u *url.URL) bool

SecureContext reports whether browsers treat the pages of u as a secure context, where they keep the Secure session cookie: https, or http on a loopback host — localhost, a name under .localhost, either with a trailing dot, 127.0.0.0/8 or ::1.

Types

type Config

type Config struct {
	// Database is the main connection, for every query; Session the session-capable connection, for advisory locks
	// and LISTEN.
	Database Database
	Session  Database

	// SecretKeys is the value of MUSTER_SECRET_KEYS or the content of MUSTER_SECRET_KEYS_FILE, and SecretKeysSource
	// the variable that was set, empty when neither was; internal/keyring reads and checks them.
	SecretKeys       logging.Secret
	SecretKeysSource string
	PublicURL        *url.URL
	IngestURL        *url.URL

	ListenApp      string
	ListenIngest   string
	ListenInternal string

	LogLevel       logging.Level
	MigrateOnStart bool
	TrustedProxies []netip.Prefix
	RunbookBaseURL *url.URL

	BootstrapAdminEmail    string
	BootstrapAdminPassword logging.Secret

	// Conflicts are the settings given twice, where one form wins; the caller logs them once the logger exists.
	Conflicts []Conflict
}

Config is the validated bootstrap configuration.

func Load

func Load(environ []string) (Config, error)

Load reads the configuration from environ, in the form of os.Environ. It reads no variable outside MUSTER_*; the error joins one error per invalid variable.

type Conflict

type Conflict struct {
	Used    string
	Ignored []string
}

Conflict is a setting given both as a URL and as fields: Used wins and Ignored are not read.

type Database

type Database struct {
	// URL is a postgres:// URL with the password; it is never logged.
	URL logging.Secret
	// SSLMode is the sslmode in effect, prefer when the URL names none.
	SSLMode string
}

Database is one database connection.

type Variable

type Variable struct {
	Name string
	// Default is the value of a variable that is not set; empty when it has none.
	Default     string
	Description string
	// File is the *_FILE variable that may hold the value instead; empty when there is none.
	File string
	// Secret is set for a value that is never repeated in an error or a log line.
	Secret bool
}

Variable is a bootstrap setting as the reference page lists it.

func Variables

func Variables() []Variable

Variables lists the bootstrap settings in the order of their declaration. A *_FILE variable is not listed on its own: it is the File of its secret.

Jump to

Keyboard shortcuts

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