config

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: MIT Imports: 40 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 provides configuration types and validation for OSAPI.

Index

Constants

View Source
const (
	RuleFile    = "file"
	RuleParse   = "parse"
	RuleValue   = "value"
	RuleSetting = "setting"
	RuleBucket  = "bucket"
	RuleVault   = "vault"
	// RuleReference is the rule of a reference, secret://<vault>/<key>, in
	// a secret field of the config.
	RuleReference = "reference"
)

The rules that Load checks, by the name that config validate reports.

View Source
const (
	SourceEnv     = "env"
	SourceFile    = "file"
	SourceDefault = "default"
	SourceUnset   = "unset"
)

Where a key's value came from, highest precedence first.

View Source
const DefaultFile = "/etc/osapi/osapi.yaml"

DefaultFile is the config file that osapi reads when -f and OSAPI_OSAPIFILE name none.

View Source
const DefaultVaultKeyFile = "/etc/osapi/secrets.key"

DefaultVaultKeyFile is the key file of the default vault, which the controller makes when it is not there.

View Source
const EnvPrefix = "OSAPI"

EnvPrefix is the prefix of every environment variable that sets a key.

View Source
const SigningKeyFile = "signing.key"

SigningKeyFile is the file in controller.pki.key_dir of the signing key that the controller makes when the config has none.

View Source
const SigningKeyID = "local"

SigningKeyID is the id of that key, which each token that it signs names.

Variables

View Source
var (
	SelfSignedHostname = os.Hostname
	SelfSignedWrite    = os.WriteFile
)

SelfSignedHostname and SelfSignedWrite are os.Hostname and os.WriteFile, for a test to replace.

View Source
var Checks = guide.Checks{
	{
		Rule:     RuleFile,
		Requires: "The config file exists, and osapi can read it.",
		Fix:      "Give the path with -f, or put the file at /etc/osapi/osapi.yaml. Check that the user that runs osapi can read it.",
	},
	{
		Rule:     RuleParse,
		Requires: "The file is YAML, and each value has the type of its key.",
		Fix:      "Correct the YAML at the line that the message names. osapi config list shows the type of each key.",
	},
	{
		Rule:     RuleValue,
		Requires: "Each value passes the validate rule of its key, with the defaults and the environment applied.",
		Fix:      "Set the key to a value that its rule allows. osapi config get --key <key> shows its rule, type and default.",
	},
	{
		Rule:     RuleSetting,
		Requires: "Each setting of a behavior, under behaviors.<name>, passes its validate rule.",
		Fix:      "Set the key to a value that its rule allows. osapi dsl behavior get --name <name> lists the settings of the behavior.",
	},
	{
		Rule:     RuleBucket,
		Requires: "Each NATS bucket has its own name. A shared bucket mixes the keys of two roles.",
		Fix:      "Give one of the two keys that the message names a different bucket.",
	},
	{
		Rule:     RuleVault,
		Requires: "Each vault of controller.secrets.vaults has its own name and its own key_file, a type of vault that osapi knows, a config block that its type takes, and what its type needs, such as the key of a nats vault.",
		Fix:      "Correct the vault that the message names. osapi config get --key controller.secrets.vaults describes a vault, and the message names the types and the settings that there are.",
	},
	{
		Rule:     RuleReference,
		Requires: "Each reference, secret://<vault>/<key>, is in a secret field that can take one, and names a vault of controller.secrets.vaults and a key of 1 to 128 letters, digits, - or _. A NATS password cannot be a reference, because osapi needs it to connect to NATS before it can read a vault.",
		Fix:      "Add the vault that the reference names to controller.secrets.vaults, or correct the reference. For a NATS password, put the value in the file or in its environment variable.",
	},
}

Checks are the rules that Load applies to a config file, in the order that it applies them. config validate --help prints each one, and the problem that config validate reports carries the fix of its rule. Each Rule constant has one entry; a test fails on a rule without one.

Functions

func AddFlag added in v0.3.0

func AddFlag(
	fs *pflag.FlagSet,
	v *viper.Viper,
	k Key,
	name string,
)

AddFlag adds the flag name to fs for k, with its type, default and doc, and binds it to k in v: v resolves the flag, then the environment, then the file, then the default, when the config is read.

func BindFlagAs added in v0.3.0

func BindFlagAs(
	fs *pflag.FlagSet,
	key string,
	name string,
)

BindFlagAs is BindFlags for one key, with a flag name of its own, such as --url for controller.client.url. Thus the flag's default is the key's, from the definition that owns it, and not a second copy in the command.

func BindFlags added in v0.3.0

func BindFlags(
	fs *pflag.FlagSet,
	keys ...string,
)

BindFlags adds a flag to fs for each of osapi's keys, named by FlagName, with the key's type, default and doc, and binds it to the key in viper. The generated command of a process calls it for each key its Flag names. A key that is not osapi's is a mistake in the code, so it panics.

func CertSources added in v0.3.0

func CertSources(
	c Config,
) []pki.CertSource

CertSources are the certificates that the servers of c serve on this host: the API, the metrics of the controller, of NATS and of the agent, and the NATS server. Each is its cert_file, or the self-signed one in its component's key directory.

func CertSourcesOf added in v0.3.0

func CertSourcesOf(
	c Config,
	component ...string,
) []pki.CertSource

CertSourcesOf are the CertSources of c that component serves, such as agent.

func DefaultYAML added in v0.3.0

func DefaultYAML() string

DefaultYAML is the whole config as YAML, each key at its default with its doc above it, from Keys: what osapi config default get prints, and the start of a config file. A key with no default, a choice of the operator, is commented out with why. Thus no sample config is kept by hand.

func DocTable added in v0.3.0

func DocTable(
	prefixes []string,
) string

DocTable is the keys under prefixes as a markdown table, its columns padded as Prettier pads them: each key, its type, its default, the environment variable that sets it and what it is for. A key with no default says why: it is a choice of the operator.

func DocTables added in v0.3.0

func DocTables(
	page string,
) string

DocTables is page with each generated config table written again, from Keys: a table goes between <!-- osapi:config prefixes --> and <!-- /osapi:config -->. A page with no markers is as it is.

func EnsureSigningKey added in v0.3.0

func EnsureSigningKey(
	c *Config,
) error

EnsureSigningKey gives c the signing key in controller.pki.key_dir when its config has none, and makes the key first when it is not there. Thus a controller with an empty config verifies tokens, and controller token generate on its host signs them with the same key. A key in the config wins: the file is used only when there is none.

func EnvName added in v0.3.0

func EnvName(
	key string,
) string

EnvName is the environment variable that sets key: OSAPI_, then the key in capitals with its dots as underscores.

func FlagName added in v0.3.0

func FlagName(
	key string,
) string

FlagName is the flag that sets key: the key with its dots and underscores as dashes, such as --agent-max-jobs for agent.max_jobs, as OSAPI_AGENT_MAX_JOBS is its environment variable.

func Load added in v0.3.0

func Load(
	v *viper.Viper,
	path string,
	c *Config,
) error

Load reads the config file at path into v and c, with every key's default and environment variable applied, then checks it. It is what osapi start runs: a missing file or a value that breaks a rule is an error, with the rule of the first problem and the message of each.

func MakeSelfSigned added in v0.3.0

func MakeSelfSigned(
	certFile string,
	keyFile string,
) error

MakeSelfSigned makes a self-signed certificate at certFile and keyFile, as WithSelfSigned makes one with no URLs, such as the next certificate of a rotation, beside the current one.

func NATSAuthDir added in v0.3.0

func NATSAuthDir(
	keyDir string,
) string

NATSAuthDir is where osapi's NATS server keeps the credentials that it makes in operator mode with no resolver_file: nats-auth in its key directory.

func Read added in v0.3.0

func Read(
	v *viper.Viper,
	path string,
	c *Config,
) (found bool, err error)

Read reads the config file at path into v and c, with every key's default and environment variable applied, without checking it. A missing file is not an error, so defaults and the environment can be shown without one; found says whether it was there. Every key is bound to its environment variable, so one set in the environment applies even when the file does not mention the key.

func References added in v0.3.0

func References(
	c *Config,
	prefix string,
) []string

References are the keys of c that start with prefix, such as controller.api.security.signing_keys, whose values are references.

func ResolveReferences added in v0.3.0

func ResolveReferences(
	ctx context.Context,
	c *Config,
	prefix string,
	resolve Resolver,
) error

ResolveReferences puts the value of each reference of c, under the keys that start with prefix, in place of the reference. Each value passes the rule of its key, such as signing_key. An error names the key and the reference, and never a value.

func RuleOf added in v0.3.0

func RuleOf(
	err error,
) string

RuleOf is the rule that err breaks, or "" when err is not an Error.

func SelfClient added in v0.3.0

func SelfClient(
	server *tls.Config,
) *tls.Config

SelfClient is the TLS config with which a server of osapi connects to itself, such as the NATS server for its setup and heartbeat, from the config that it serves: it trusts the certificate that the server serves at the time of each handshake, so a certificate that the server loads again changes nothing for it. Nil when the server serves no TLS.

func SelfSignedFiles added in v0.3.0

func SelfSignedFiles(
	dir string,
	name string,
) (string, string)

SelfSignedFiles are the certificate and key files of the self-signed certificate name in dir, such as api.crt and api.key.

func Source added in v0.3.0

func Source(
	v *viper.Viper,
	key string,
) string

Source is where key's value in v came from: the environment, the config file, a default, or nowhere.

func Spec added in v0.3.0

func Spec() guide.Spec

Spec is the config file as a spec: a section for each top word of a key, such as controller, and a term for each key, from Keys. osapi config spec get prints it, as each DSL's spec get prints the parts of the DSL.

func SpecOf added in v0.3.0

func SpecOf(
	keys []Key,
) guide.Spec

SpecOf is the spec of keys.

func Validate

func Validate(
	c *Config,
) error

Validate validates a structs exposed fields.

func Value added in v0.3.0

func Value(
	v *viper.Viper,
	k Key,
) any

Value is k's value in v, as k's type: an environment variable arrives as text, and is converted so it reads the same as a value from the file.

Types

type APIServer

type APIServer struct {
	// Host the server binds to. Empty binds every interface. The UI uses the
	// same listener.
	Host string `` /* 155-byte string literal not displayed */
	// URL is where a person reaches the API. Health shows it beside the bind
	// address; osapi never requests it.
	URL string `` /* 192-byte string literal not displayed */
	// Port the server will bind to.
	Port int `mapstructure:"port" doc:"Port the REST API server listens on." validate:"min=1,max=65535"`
	// Security contains security-related configuration for the server, such as CORS and tokens.
	Security ServerSecurity `mapstructure:"security"`
	// TLS makes the server serve HTTPS.
	TLS ServerTLS `mapstructure:"tls"`
	// JobTimeout is how long the controller waits for agent responses
	// before returning partial results. Uses Go duration format.
	// Defaults to 30s when empty.
	JobTimeout string `` /* 156-byte string literal not displayed */
}

APIServer holds the HTTP server config (port + security).

type AgentCommand added in v0.3.0

type AgentCommand struct {
	// Enabled lets the agent run command exec, command shell and docker exec.
	// When it is false, the agent refuses those jobs. The agent makes the check,
	// so it also refuses a job that gets to it without the API.
	Enabled bool `` /* 164-byte string literal not displayed */
}

AgentCommand configures the operations that run a command the caller supplies: command exec, command shell and docker exec.

type AgentConditions

type AgentConditions struct {
	MemoryPressureThreshold int     `mapstructure:"memory_pressure_threshold" validate:"min=1,max=100" doc:"Memory pressure threshold (percent used)."`
	HighLoadMultiplier      float64 `mapstructure:"high_load_multiplier"      validate:"gt=0"          doc:"High load multiplier (load1 / cpu_count)."`
	DiskPressureThreshold   int     `mapstructure:"disk_pressure_threshold"   validate:"min=1,max=100" doc:"Disk pressure threshold (percent used)."`
}

AgentConditions holds threshold configuration for node conditions.

type AgentConfig

type AgentConfig struct {
	// Join is the join string: nats:// or tls:// for a join over NATS, or
	// osapi://<host>:<port>?token=...&fp=SHA256:... for one over HTTPS,
	// that osapi controller join token create prints. An agent that is not
	// admitted joins with it at its first start.
	Join string `` /* 413-byte string literal not displayed */
	// NATS connection settings for the agent.
	NATS NATSConnection `mapstructure:"nats"`
	// Consumer settings for the agent's JetStream consumer.
	Consumer AgentConsumer `mapstructure:"consumer,omitempty"`
	// Facts settings for the agent's facts collection.
	Facts AgentFacts `mapstructure:"facts,omitempty"`
	// Hostname identifies this agent instance for routing.
	Hostname string `` /* 150-byte string literal not displayed */
	// MaxJobs maximum number of concurrent jobs to process.
	MaxJobs int `mapstructure:"max_jobs" doc:"Maximum number of concurrent jobs to process." validate:"min=1"`
	// Labels are key-value pairs for label-based routing (e.g., role: web, env: prod).
	// Maximum 5 labels per agent — each label creates multiple NATS consumers
	// for hierarchical prefix matching.
	Labels map[string]string `` /* 296-byte string literal not displayed */
	// Conditions holds threshold settings for node condition evaluation.
	Conditions AgentConditions `mapstructure:"conditions,omitempty"`
	// ProcessConditions holds threshold settings for process-level condition evaluation.
	ProcessConditions ProcessConditions `mapstructure:"process_conditions,omitempty"`
	// PrivilegeEscalation configures least-privilege agent mode.
	PrivilegeEscalation PrivilegeEscalation `mapstructure:"privilege_escalation,omitempty"`
	// Command enables the operations that run a command the caller supplies.
	Command AgentCommand `mapstructure:"command,omitempty"`
	// PKI holds PKI enrollment and signing settings.
	PKI     AgentPKI      `mapstructure:"pki,omitempty"`
	Metrics MetricsServer `mapstructure:"metrics"`
}

AgentConfig configuration settings.

type AgentConsumer

type AgentConsumer struct {
	// Name is the durable consumer name.
	Name string `mapstructure:"name" doc:"Durable consumer name."`
	// MaxDeliver is the maximum number of redelivery attempts before sending to DLQ.
	MaxDeliver int `mapstructure:"max_deliver" doc:"Maximum redelivery attempts before sending to DLQ."`
	// AckWait is the time to wait for an ACK before redelivering.
	AckWait string `mapstructure:"ack_wait" doc:"Time to wait for an ACK before redelivering." validate:"omitempty,go_duration"` // e.g. "30s", "1m"
	// MaxAckPending is the maximum outstanding unacknowledged messages.
	MaxAckPending int `mapstructure:"max_ack_pending" doc:"Maximum outstanding unacknowledged messages."`
	// ReplayPolicy is "instant" or "original".
	ReplayPolicy string `mapstructure:"replay_policy" doc:"Replay policy: 'instant' or 'original'."`
	// BackOff durations between redelivery attempts.
	BackOff []string `mapstructure:"back_off" doc:"Backoff durations between redelivery attempts."` // e.g. ["30s", "2m", "5m"]
	// InactiveThreshold is how long a consumer can be idle before NATS
	// removes it.
	InactiveThreshold string `` // e.g. "24h"
	/* 162-byte string literal not displayed */
}

AgentConsumer configuration for the agent's JetStream consumer settings.

type AgentFacts

type AgentFacts struct {
	// Interval is how often the agent collects and publishes facts.
	Interval string `mapstructure:"interval" validate:"omitempty,go_duration" doc:"How often the agent collects and publishes facts."` // e.g. "5m", "1h"
}

AgentFacts configuration for the agent's facts collection settings.

type AgentPKI

type AgentPKI struct {
	// KeyDir is the directory for agent keypair storage.
	KeyDir string `mapstructure:"key_dir" doc:"Directory of the agent's key pair."`
}

AgentPKI holds PKI configuration for the agent.

type CORS

type CORS struct {
	// List of origins allowed to access the server (e.g., "foo").
	AllowOrigins []string `` /* 182-byte string literal not displayed */
}

CORS represents the CORS (Cross-Origin Resource Sharing) settings.

type Client

type Client struct {
	// URL the client will connect to
	URL string `mapstructure:"url" doc:"Base URL the CLI client connects to."`
	// Security contains security-related configuration for the client, such as access tokens.
	Security ClientSecurity `mapstructure:"security"`
	// TLS is what the client trusts on an https:// URL.
	TLS ClientTLS `mapstructure:"tls"`
}

Client configuration settings.

type ClientSecurity

type ClientSecurity struct {
	// BearerToken is the JWT used for role-based access control.
	BearerToken string `` /* 351-byte string literal not displayed */
}

ClientSecurity represents security-related settings for the client.

type ClientTLS added in v0.3.0

type ClientTLS struct {
	// Enabled connects with TLS. A URL with https:// uses TLS without it.
	Enabled bool `mapstructure:"enabled" doc:"Connect with TLS. A URL that starts with https:// uses TLS without it."`
	// CAFile is a PEM certificate that osapi trusts, besides the system's
	// roots, such as a private CA or a self-signed certificate.
	CAFile string `` /* 248-byte string literal not displayed */
	// CertFile and KeyFile are the client certificate, for a server that
	// asks for one (mutual TLS).
	CertFile string `` /* 215-byte string literal not displayed */
	// KeyFile is the PEM private key of CertFile.
	KeyFile string `` /* 154-byte string literal not displayed */
	// ServerName is the name to check the certificate against, when it is
	// not the host that osapi connects to.
	ServerName string `` /* 170-byte string literal not displayed */
	// InsecureSkipVerify accepts any certificate. osapi logs a warning at
	// each start that has it on.
	InsecureSkipVerify bool `` /* 202-byte string literal not displayed */
}

ClientTLS is how osapi checks a server that it connects to over TLS: the CLI to the controller, the OTLP exporter and the trace reader to the tracing backend, and the controller and each agent to NATS. ClientTLS.Config builds the TLS config of each.

func (ClientTLS) Config added in v0.3.0

func (c ClientTLS) Config() (*tls.Config, error)

Config is the TLS config of a connection with c: the system's roots and ca_file, the client certificate, the server name, and InsecureSkipVerify.

func (ClientTLS) Dial added in v0.3.0

func (c ClientTLS) Dial(
	host string,
) (*tls.Config, error)

Dial is the TLS config of a connection to host that has no scheme to decide, such as one to NATS: nil when c is not enabled, else Config. With a ca_file, it reads the file again at each handshake, and checks the server's chain against it and host or server_name: a connection that reconnects trusts a certificate that the file gained since it connected, such as the next one of a rotation of the NATS server's certificate.

func (ClientTLS) Warn added in v0.3.0

func (c ClientTLS) Warn(
	log *slog.Logger,
	key string,
)

Warn logs a warning when c accepts any certificate, with the key of its setting, such as telemetry.tracing.tls, at each start that has it on.

type Config

type Config struct {
	Controller Controller  `mapstructure:"controller"`
	Agent      AgentConfig `mapstructure:"agent,omitempty"`
	NATS       NATS        `mapstructure:"nats"`
	Telemetry  Telemetry   `mapstructure:"telemetry"`
	// Debug enable or disable debug option set from CLI.
	Debug bool `mapstructure:"debug" doc:"Enable verbose logging."`
}

Config represents the root structure of the YAML configuration file. This struct is used to unmarshal configuration data from Viper.

func TrustLocal added in v0.3.0

func TrustLocal(
	c Config,
) Config

TrustLocal is c where each client that connects to a server of osapi on this host, with TLS and no ca_file, trusts that server's self-signed certificate in its key directory: the CLI the API's api.crt, and the controller and the agent the NATS server's nats.crt. A server with its own cert_file, or one on another host, needs ca_file, or the pin of a join string. An agent with agent.join is left as it is: its join gives it its NATS server, its user and what it trusts (osapi#1491).

func (Config) JoinURL added in v0.3.0

func (c Config) JoinURL() string

JoinURL is where an agent reaches NATS in a join: controller.join.url, or else nats.server.url.

func (Config) JoinUsers added in v0.3.0

func (c Config) JoinUsers() (NATSUser, NATSUser)

JoinUsers are the bootstrap user and the agent user of the join over NATS: controller.join's, or else the users of the embedded server with the roles join and agent.

type Controller

type Controller struct {
	Client        Client              `mapstructure:"client"`
	API           APIServer           `mapstructure:"api"`
	NATS          NATSConnection      `mapstructure:"nats"`
	Metrics       MetricsServer       `mapstructure:"metrics"`
	Notifications NotificationsConfig `mapstructure:"notifications,omitempty"`
	// UI holds settings for the embedded management UI.
	UI UIConfig `mapstructure:"ui,omitempty"`
	// PKI holds PKI enrollment and signing settings.
	PKI ControllerPKI `mapstructure:"pki,omitempty"`
	// Secrets holds the vaults that the controller resolves secrets from.
	Secrets ControllerSecrets `mapstructure:"secrets,omitempty"`
	// Join is the join of an agent over NATS.
	Join ControllerJoin `mapstructure:"join,omitempty"`
}

Controller holds the control plane configuration.

type ControllerJoin added in v0.3.0

type ControllerJoin struct {
	// URL is where an agent reaches NATS, in the join string.
	URL string `` /* 272-byte string literal not displayed */
	// User is the bootstrap user, which can only send the join request.
	User NATSUser `` /* 257-byte string literal not displayed */
	// SigningKeyFile is, in operator mode, an account signing key seed, which
	// the controller mints the users of a join with.
	SigningKeyFile string `` /* 277-byte string literal not displayed */
	// AgentTTL is how long the JWT of an agent's NATS user lasts, in
	// operator mode. The agent renews it before then.
	AgentTTL string `` /* 368-byte string literal not displayed */
	// JoinSigningKeyFile is the signing key of the join's bootstrap users,
	// when it is not SigningKeyFile.
	JoinSigningKeyFile string `` /* 268-byte string literal not displayed */
	// Scoped is whether the signing keys are scoped: the template of each
	// sets the permissions, and the JWTs that they sign carry none.
	Scoped bool `` /* 334-byte string literal not displayed */
	// Account is the public key of the account of SigningKeyFile.
	Account string `` /* 154-byte string literal not displayed */
	// Agent is the NATS user that the join gives the agent.
	Agent NATSUser `` /* 206-byte string literal not displayed */
	// Callout is osapi's auth callout service, for a NATS server whose
	// auth_callout block names osapi's issuer key.
	Callout JoinCallout `mapstructure:"callout"`
}

ControllerJoin is the join of an agent over NATS: where the agent reaches NATS, the bootstrap user that the join string carries, and the user that the join gives the agent. With the embedded server, the two users default to the users of nats.server.auth.users with the roles join and agent.

type ControllerPKI

type ControllerPKI struct {
	// KeyDir is the directory for controller keypair storage.
	KeyDir string `mapstructure:"key_dir" doc:"Directory for controller keypair storage."`
	// AutoAdmit admits each machine that asks to join, with no operator.
	AutoAdmit bool `mapstructure:"auto_admit" doc:"Admit each machine that asks to join, with no operator (dev/test only)."`
	// RotationGracePeriod is how long both old and new keys are accepted
	// during key rotation. Uses Go duration format.
	RotationGracePeriod string `` /* 170-byte string literal not displayed */
	// DeleteAfter deletes an admitted machine that has not reported for
	// this long. Empty is never. Uses Go duration format.
	DeleteAfter string `` /* 232-byte string literal not displayed */
}

ControllerPKI holds PKI configuration for the controller.

type ControllerSecrets added in v0.3.0

type ControllerSecrets struct {
	// Vaults are the vaults, each with its name, type and targets.
	Vaults []vault.Spec `` /* 182-byte string literal not displayed */
}

ControllerSecrets holds the vaults of the controller.

type CustomRole

type CustomRole struct {
	// Permissions granted to this role.
	Permissions []types.Permission `mapstructure:"permissions" validate:"dive,permission"`
}

CustomRole defines a named set of permissions that can be assigned to tokens.

type Error added in v0.3.0

type Error struct {
	Rule string
	Err  error
}

Error is a failure of Load, with the rule that it breaks.

func (*Error) Error added in v0.3.0

func (e *Error) Error() string

Error is the message of the failure.

func (*Error) Unwrap added in v0.3.0

func (e *Error) Unwrap() error

Unwrap is the failure without its rule.

type JoinCallout added in v0.3.0

type JoinCallout struct {
	// IssuerKeyFile is the seed of the account key that the server's
	// auth_callout block names as its issuer.
	IssuerKeyFile string `` /* 322-byte string literal not displayed */
	// Account is the account that a join or an agent goes in.
	Account string `` /* 168-byte string literal not displayed */
	// Auth is how the controller connects as the user of the server's
	// auth_users that answers the server. Make it an nkey: a server with no
	// nkey user offers no nonce, and an agent signs the nonce with its key.
	Auth NATSAuth `` /* 285-byte string literal not displayed */
}

JoinCallout is osapi's auth callout service: the NATS server sends it each connection that is not one of its auth_users, and the controller decides it, a join token or an admitted agent's key.

type KVBucketInfo

type KVBucketInfo struct {
	// Name is a human-readable label for the bucket (e.g. "job-queue").
	Name string
	// Key is the config key that sets the bucket (e.g. "nats.kv.bucket").
	Key string
	// Bucket is the bucket name from the config field.
	Bucket string
}

KVBucketInfo holds a KV bucket's human-readable name and its configured bucket name. It is returned by NATS.AllKVBuckets so callers can iterate all KV buckets without manually listing every sub-config field.

type Key added in v0.3.0

type Key struct {
	Name    string `json:"name"`
	Env     string `json:"env"`
	Type    string `json:"type"`
	Default any    `json:"default,omitempty"`
	// Choice says why the key has no default: it is a real choice of the
	// operator, such as a URL or a credential.
	Choice   string `json:"choice,omitempty"`
	Validate string `json:"validate,omitempty"`
	Doc      string `json:"doc,omitempty"`
	// Secret is true for a value that is never printed: a password, a
	// signing key or a token.
	Secret bool `json:"secret,omitempty"`
	// Behavior names the behavior that declared the key, for a behavior
	// setting.
	Behavior string `json:"behavior,omitempty"`
	// Group names the endpoint group that declared the key, for a group
	// setting.
	Group string `json:"group,omitempty"`
	// Flag is the agent start flag bound to a behavior setting.
	Flag string `json:"flag,omitempty"`
}

Key is one setting osapi reads: its dotted name, the environment variable that sets it, its type, its default, its constraints and what it is for.

func Keys added in v0.3.0

func Keys() []Key

Keys lists every setting: osapi's own, in the order the config types declare them, with each registered endpoint group's after the last key of the controller, under controller.endpoints.<name>, then each registered behavior's, under behaviors.<name>. A struct is walked into; a list, a map or a scalar is one key.

func VaultKeys added in v0.3.0

func VaultKeys() []Key

VaultKeys lists the settings of a vault, under controller.secrets.vaults[], then the settings of the config block of each registered type, under controller.secrets.vaults[].config, with the type in the doc. A table of the docs shows them, as it shows the keys of Keys. An environment variable does not set one, because a vault is an item of a list.

type MetricsServer

type MetricsServer struct {
	// Enabled activates the metrics server.
	Enabled bool `mapstructure:"enabled" doc:"Enable the metrics endpoint."`
	// Host the metrics server binds to.
	Host string `mapstructure:"host" doc:"Host the metrics server binds to."`
	// Port the metrics server listens on.
	Port int `mapstructure:"port" doc:"Port the metrics server listens on." validate:"omitempty,min=1,max=65535"`
	// URL is where a person opens the metrics endpoint. Health shows it
	// beside the bind address; osapi never requests it.
	URL string `` /* 203-byte string literal not displayed */
	// TLS makes the metrics server serve HTTPS.
	TLS ServerTLS `mapstructure:"tls"`
}

MetricsServer configures the per-component metrics HTTP server.

func (MetricsServer) Address added in v0.3.0

func (m MetricsServer) Address() string

Address is where m listens, with https:// when it serves TLS, as health reports it.

type NATS

type NATS struct {
	Server     NATSServer     `mapstructure:"server,omitempty"`
	Stream     NATSStream     `mapstructure:"stream,omitempty"`
	KV         NATSKV         `mapstructure:"kv,omitempty"`
	DLQ        NATSDLQ        `mapstructure:"dlq,omitempty"`
	Audit      NATSAudit      `mapstructure:"audit,omitempty"`
	Registry   NATSRegistry   `mapstructure:"registry,omitempty"`
	Facts      NATSFacts      `mapstructure:"facts,omitempty"`
	State      NATSState      `mapstructure:"state,omitempty"`
	Objects    NATSObjects    `mapstructure:"objects,omitempty"`
	FileState  NATSFileState  `mapstructure:"file_state,omitempty"`
	Enrollment NATSEnrollment `mapstructure:"enrollment,omitempty"`
	Secrets    NATSSecrets    `mapstructure:"secrets,omitempty"`
}

NATS configuration settings.

func (NATS) AllKVBuckets

func (n NATS) AllKVBuckets() []KVBucketInfo

AllKVBuckets returns all KV bucket configurations declared in the NATS config. Each entry carries a human-readable name and the bucket name from config. Entries with an empty Bucket field are still included so that callers can filter by their own policy.

func (NATS) AllObjectStoreBuckets

func (n NATS) AllObjectStoreBuckets() []ObjectStoreBucketInfo

AllObjectStoreBuckets returns all Object Store bucket configurations declared in the NATS config. Entries with an empty Bucket field are still included so that callers can filter by their own policy.

type NATSAudit

type NATSAudit struct {
	// Stream is the JetStream stream name for audit log entries.
	Stream string `mapstructure:"stream" doc:"JetStream stream name for audit log entries."`
	// Subject is the base subject prefix for audit messages.
	Subject  string `mapstructure:"subject"   doc:"Base subject prefix for audit messages."`
	MaxAge   string `mapstructure:"max_age"   doc:"Maximum age of audit entries (Go duration). Default 30 days." validate:"omitempty,go_duration"` // e.g. "720h" (30 days)
	MaxBytes int64  `mapstructure:"max_bytes" doc:"Maximum total size of the audit stream in bytes."`
	Storage  string `mapstructure:"storage"   doc:"Storage backend: 'file' or 'memory'."` // "file" or "memory"
	Replicas int    `mapstructure:"replicas"  doc:"Number of stream replicas."`
}

NATSAudit configuration for the audit log stream.

type NATSAuth

type NATSAuth struct {
	// Type is the auth method: "none", "user_pass", "nkey", or "creds".
	Type string `mapstructure:"type" doc:"Authentication type: 'none', 'user_pass', 'nkey', or 'creds'."`
	// Username for user_pass auth.
	Username string `mapstructure:"username" doc:"Username for user_pass auth." choice:"set for the auth type that uses it"`
	// Password for user_pass auth.
	Password string `` /* 237-byte string literal not displayed */
	// NKeyFile path to the NKey seed file for nkey auth.
	NKeyFile string `mapstructure:"nkey_file" doc:"Path to the NKey seed file for nkey auth." choice:"set for the auth type that uses it"`
	// CredsFile path to a NATS credentials file, a user JWT and its seed, for
	// creds auth against a server in operator (JWT) mode.
	CredsFile string `` /* 143-byte string literal not displayed */
}

NATSAuth holds client-side authentication settings for connecting to NATS.

type NATSConnection

type NATSConnection struct {
	// Host the NATS server hostname.
	Host string `mapstructure:"host" doc:"NATS server hostname to connect to."`
	// Port the NATS server port.
	Port int `mapstructure:"port" doc:"NATS server port to connect to." validate:"min=1,max=65535"`
	// ClientName the NATS client name for identification.
	ClientName string `mapstructure:"client_name" doc:"Client name sent to NATS for identification."`
	// Namespace is a prefix for all NATS subjects used by this client.
	Namespace string `mapstructure:"namespace" doc:"Subject namespace prefix. Must match nats.server.namespace." validate:"omitempty,nats_name"`
	// Auth holds client-side authentication configuration.
	Auth NATSAuth `mapstructure:"auth,omitempty"`
	// TLS is how the connection checks a NATS server that serves TLS.
	TLS ClientTLS `mapstructure:"tls"`
}

NATSConnection is a reusable NATS connection configuration block.

type NATSDLQ

type NATSDLQ struct {
	MaxAge   string `mapstructure:"max_age"  validate:"omitempty,go_duration" doc:"Maximum age of messages in the DLQ."` // e.g. "7d", "24h"
	MaxMsgs  int64  `mapstructure:"max_msgs"                                  doc:"Maximum number of messages retained."`
	Storage  string `mapstructure:"storage"                                   doc:"Storage backend: 'file' or 'memory'."` // "file" or "memory"
	Replicas int    `mapstructure:"replicas"                                  doc:"Number of DLQ replicas."`
}

NATSDLQ configuration for Dead Letter Queue stream settings.

type NATSEnrollment

type NATSEnrollment struct {
	// Bucket is the KV bucket name for pending enrollment entries.
	Bucket   string `mapstructure:"bucket"   validate:"omitempty,nats_name" doc:"KV bucket for pending enrollment entries."`
	Storage  string `mapstructure:"storage"                                 doc:"Storage backend: 'file' or 'memory'."` // "file" or "memory"
	Replicas int    `mapstructure:"replicas"                                doc:"Number of replicas for the enrollment KV bucket."`
}

NATSEnrollment configuration for the PKI enrollment KV bucket. No TTL — pending enrollment requests persist until accepted or rejected.

type NATSFacts

type NATSFacts struct {
	// Bucket is the KV bucket name for agent facts entries.
	Bucket   string `mapstructure:"bucket"   validate:"omitempty,nats_name"   doc:"KV bucket for agent facts entries."`
	TTL      string `mapstructure:"ttl"      validate:"omitempty,go_duration" doc:"TTL for facts entries (Go duration)."` // e.g. "1h"
	Storage  string `mapstructure:"storage"                                   doc:"Storage backend: 'file' or 'memory'."` // "file" or "memory"
	Replicas int    `mapstructure:"replicas"                                  doc:"Number of KV replicas."`
}

NATSFacts configuration for the agent facts KV bucket.

type NATSFileState

type NATSFileState struct {
	// Bucket is the KV bucket name for file deployment SHA tracking.
	Bucket   string ``                                                                                                  /* 154-byte string literal not displayed */
	Storage  string `mapstructure:"storage"                                 doc:"Storage backend: 'file' or 'memory'."` // "file" or "memory"
	Replicas int    `mapstructure:"replicas"                                doc:"Number of KV replicas."`
}

NATSFileState configuration for the file deployment state KV bucket. No TTL — deployed file state persists until explicitly removed.

type NATSKV

type NATSKV struct {
	// Bucket is the KV bucket name for job definitions, status events and
	// agent results.
	Bucket string `` /* 130-byte string literal not displayed */
	TTL    string `` // e.g. "24h"
	/* 206-byte string literal not displayed */
	MaxBytes int64  `mapstructure:"max_bytes"                               doc:"Maximum total size of the bucket in bytes."`
	Storage  string `mapstructure:"storage"                                 doc:"Storage backend: 'file' or 'memory'."` // "file" or "memory"
	Replicas int    `mapstructure:"replicas"                                doc:"Number of KV replicas."`
}

NATSKV configuration for KeyValue bucket settings.

type NATSObjects

type NATSObjects struct {
	// Bucket is the Object Store bucket name for file content.
	Bucket   string `mapstructure:"bucket"    validate:"omitempty,nats_name" doc:"Object Store bucket for uploaded file content."`
	MaxBytes int64  `mapstructure:"max_bytes"                                doc:"Maximum total size of the bucket in bytes."`
	Storage  string `mapstructure:"storage"                                  doc:"Storage backend: 'file' or 'memory'."` // "file" or "memory"
	Replicas int    `mapstructure:"replicas"                                 doc:"Number of Object Store replicas."`
}

NATSObjects configuration for the NATS Object Store bucket.

type NATSRegistry

type NATSRegistry struct {
	// Bucket is the KV bucket name for agent registration entries.
	Bucket string `mapstructure:"bucket"   validate:"required,nats_name"    doc:"KV bucket for agent heartbeat registration."`
	TTL    string `` // e.g. "30s"
	/* 164-byte string literal not displayed */
	Storage  string `mapstructure:"storage"                                   doc:"Storage backend: 'file' or 'memory'."` // "file" or "memory"
	Replicas int    `mapstructure:"replicas"                                  doc:"Number of KV replicas."`
}

NATSRegistry configuration for the agent registry KV bucket.

type NATSSecrets added in v0.3.0

type NATSSecrets struct {
	// Bucket is the KV bucket name for the values of the nats vaults.
	Bucket string `mapstructure:"bucket" validate:"omitempty,nats_name" doc:"KV bucket for the encrypted values of each nats vault."`
	// History is how many versions of each key the bucket keeps.
	History  int    `` /* 128-byte string literal not displayed */
	Storage  string `mapstructure:"storage"                                    doc:"Storage backend: 'file' or 'memory'."`
	Replicas int    `mapstructure:"replicas"                                   doc:"Number of KV replicas."`
}

NATSSecrets configuration for the KV bucket of the nats vaults. Each value in it is encrypted, under <vault>.<key>.

type NATSServer

type NATSServer struct {
	// Host the server will bind to.
	Host string `mapstructure:"host" doc:"Host the embedded NATS server binds to."`
	// Port the server will bind to.
	Port int `mapstructure:"port" doc:"Port the embedded NATS server listens on."`
	// URL is where a person reaches the server, as nats:// or tls://. Health
	// shows it beside the bind address.
	URL string `` /* 254-byte string literal not displayed */
	// StoreDir the directory for JetStream file storage.
	StoreDir string `mapstructure:"store_dir" doc:"Directory for JetStream file storage."`
	// KeyDir is where the server keeps its self-signed certificates, of NATS
	// and of its metrics, when TLS is on with no cert_file.
	KeyDir string `` /* 183-byte string literal not displayed */
	// JetStream holds the encryption of the JetStream store.
	JetStream NATSServerJetStream `mapstructure:"jetstream"`
	// Namespace is a prefix for all NATS subjects and infrastructure names.
	Namespace string `mapstructure:"namespace" doc:"Prefix for all NATS subjects and infrastructure names." validate:"omitempty,nats_name"`
	// Auth holds server-side authentication configuration.
	Auth    NATSServerAuth `mapstructure:"auth,omitempty"`
	Metrics MetricsServer  `mapstructure:"metrics"`
	// TLS makes the server serve TLS: each client then connects with tls://.
	TLS ServerTLS `mapstructure:"tls"`
}

NATSServer configuration settings for the embedded NATS server.

type NATSServerAuth

type NATSServerAuth struct {
	// Type is the auth method: "none", "user_pass", "nkey", or "operator".
	Type string `mapstructure:"type" doc:"Auth method: 'none', 'user_pass', 'nkey' or 'operator'."`
	// ResolverFile is, for operator auth, the server's half of an operator:
	// its JWT, the system account and each account's JWT, as
	// `nsc generate config --mem-resolver` writes it.
	ResolverFile string `` /* 195-byte string literal not displayed */
	// NKeyFile is, for nkey auth, a seed whose public key is in NKeys: the
	// identity the server's own setup and heartbeat connect with.
	NKeyFile string `` /* 166-byte string literal not displayed */
	// CredsFile is, for operator auth, the credentials the server's own setup
	// and heartbeat connect with: a user in an account with JetStream.
	CredsFile string `` /* 164-byte string literal not displayed */
	// Users allowed to connect (for user_pass auth).
	Users []NATSServerUser `mapstructure:"users" doc:"Users allowed to connect (for user_pass auth)." choice:"set for the auth type that uses it"`
	// NKeys is a list of allowed public NKeys (for nkey auth).
	NKeys []string `mapstructure:"nkeys" doc:"Allowed public NKeys, for nkey auth." choice:"set for the auth type that uses it"`
	// NKeyRoles is the osapi role of each nkey of NKeys, by its public key.
	NKeyRoles map[string]string `` /* 257-byte string literal not displayed */
}

NATSServerAuth holds server-side authentication settings for the embedded NATS server.

type NATSServerJetStream added in v0.3.0

type NATSServerJetStream struct {
	// KeyFile is the file of the key that encrypts the store.
	KeyFile string `` /* 272-byte string literal not displayed */
}

NATSServerJetStream is the encryption of the JetStream store of the embedded server. With no KeyFile, the store is not encrypted.

type NATSServerUser

type NATSServerUser struct {
	// Username for the user.
	Username string `mapstructure:"username"`
	// Password for the user.
	Password string `` /* 158-byte string literal not displayed */
	// Role limits the user to the subjects of one osapi process.
	Role string `` /* 286-byte string literal not displayed */
}

NATSServerUser represents an allowed username/password pair for the NATS server.

type NATSState

type NATSState struct {
	// Bucket is the KV bucket name for persistent agent state.
	Bucket   string ``                                                                                                  /* 179-byte string literal not displayed */
	Storage  string `mapstructure:"storage"                                 doc:"Storage backend: 'file' or 'memory'."` // "file" or "memory"
	Replicas int    `mapstructure:"replicas"                                doc:"Number of KV replicas."`
}

NATSState configuration for the agent state KV bucket (drain flags, timeline events).

type NATSStream

type NATSStream struct {
	// Name is the JetStream stream name.
	Name string `mapstructure:"name" validate:"required" doc:"JetStream stream name for job notifications."`
	// Subjects is the subject filter for the stream.
	Subjects string `mapstructure:"subjects" validate:"required"              doc:"Subject filter for the stream."`
	MaxAge   string `mapstructure:"max_age"  validate:"omitempty,go_duration" doc:"Maximum age of messages in the stream (Go duration)."` // e.g. "24h", "1h30m"
	MaxMsgs  int64  `mapstructure:"max_msgs"                                  doc:"Maximum number of messages retained."`
	Storage  string `mapstructure:"storage"                                   doc:"Storage backend: 'file' or 'memory'."` // "file" or "memory"
	Replicas int    `mapstructure:"replicas"                                  doc:"Number of stream replicas (1 for single-node)."`
	Discard  string `mapstructure:"discard"                                   doc:"Discard policy when limits are reached: 'old' or 'new'."` // "old" or "new"
}

NATSStream configuration for JetStream stream settings.

type NATSUser added in v0.3.0

type NATSUser struct {
	Username string `mapstructure:"username" doc:"The username." choice:"the deployment's own user"`
	Password string `` /* 213-byte string literal not displayed */
}

NATSUser is a NATS user and its password.

type NotificationsConfig

type NotificationsConfig struct {
	// Enabled activates the condition watcher and notifier.
	Enabled bool `mapstructure:"enabled" doc:"Enable the condition watcher and notifier."`
	// Notifier selects the notification backend: "log" (default).
	Notifier string `mapstructure:"notifier" doc:"Notifier backend: 'log' (default)."`
	// RenotifyInterval is how often to re-fire active conditions.
	// Uses Go duration format (e.g., "1m", "5m", "1h"). Zero disables.
	RenotifyInterval string `` /* 156-byte string literal not displayed */
}

NotificationsConfig holds settings for the pluggable condition notification system. When Enabled is true, a Watcher monitors the registry KV bucket and dispatches ConditionEvents via the configured Notifier.

type ObjectStoreBucketInfo

type ObjectStoreBucketInfo struct {
	// Name is a human-readable label for the bucket (e.g. "file-objects").
	Name string
	// Key is the config key that sets the bucket (e.g. "nats.objects.bucket").
	Key string
	// Bucket is the bucket name from the config field.
	Bucket string
}

ObjectStoreBucketInfo holds an Object Store bucket's human-readable name and its configured bucket name. It is returned by NATS.AllObjectStoreBuckets so callers can iterate all Object Store buckets without manually listing every sub-config field.

type PrivilegeEscalation

type PrivilegeEscalation struct {
	// Enabled activates least-privilege mode: sudo for write commands
	// and capability verification at startup.
	Enabled bool `mapstructure:"enabled" doc:"Least-privilege mode: sudo for write commands and capability checks at startup."`
}

PrivilegeEscalation configuration for least-privilege agent mode. When enabled, write commands use sudo and Linux capabilities are verified at startup.

type Problem added in v0.3.0

type Problem struct {
	Rule string `json:"rule"`
	// Key is the config key that breaks the rule, such as
	// controller.api.port, when the rule is about one key.
	Key     string `json:"key,omitempty"`
	Message string `json:"message"`
	// Fix is how to fix it, from the check of Rule.
	Fix string `json:"fix" table:"-"`
}

Problem is one rule that a config breaks.

func Check added in v0.3.0

func Check(
	v *viper.Viper,
	path string,
	c *Config,
) []Problem

Check reads the config file at path into v and c as Load does, and returns every problem, each with its rule and fix, not only the first. It is what osapi config validate runs. A file that cannot be read or parsed is one problem, because nothing after it can be checked.

func Problems added in v0.3.0

func Problems(
	c *Config,
) []Problem

Problems are the rules that c, as read, breaks: each value against its validate tag, each behavior setting against its tag, and the buckets.

func (Problem) String added in v0.3.0

func (p Problem) String() string

String is the problem as one line: its key, then its message.

type ProcessConditions

type ProcessConditions struct {
	// MemoryPressureBytes is the RSS threshold in bytes (0 = disabled).
	MemoryPressureBytes int64 `mapstructure:"memory_pressure_bytes" doc:"Process RSS threshold in bytes (0 = disabled)." choice:"0 turns the condition off"`
	// HighCPUPercent is the CPU usage threshold as a percentage (0 = disabled).
	HighCPUPercent float64 `mapstructure:"high_cpu_percent" doc:"Process CPU threshold as percentage (0 = disabled)." choice:"0 turns the condition off"`
}

ProcessConditions holds threshold configuration for process-level conditions.

type Resolver added in v0.3.0

type Resolver func(ctx context.Context, ref vault.Reference) ([]byte, error)

Resolver gives the value of the key that a reference names.

type ServerSecurity

type ServerSecurity struct {
	// CORS Cross-Origin Resource Sharing (CORS) settings for the server.
	CORS CORS `mapstructure:"cors"`
	// SigningKeys are the keys that sign and verify tokens. The first key
	// signs a new token. Each key verifies a token whose kid is its ID.
	SigningKeys []SigningKey `` /* 615-byte string literal not displayed */
	// Roles defines custom roles with fine-grained permissions.
	Roles map[types.Role]CustomRole `` /* 138-byte string literal not displayed */
}

ServerSecurity represents security-related settings for the server.

func (ServerSecurity) Keys added in v0.3.0

func (s ServerSecurity) Keys() authtoken.Keys

Keys are the signing keys as authtoken uses them, in the order of the config: the first signs.

type ServerTLS added in v0.3.0

type ServerTLS struct {
	// Enabled serves TLS on the server's port, in place of plain text.
	Enabled bool `` /* 254-byte string literal not displayed */
	// CertFile is the PEM certificate to serve, with its chain.
	CertFile string `` /* 302-byte string literal not displayed */
	// KeyFile is the PEM private key of CertFile.
	KeyFile string `` /* 180-byte string literal not displayed */
}

ServerTLS makes a server of osapi serve TLS: the API, each metrics server, and the NATS server. With no certificate set, the API makes a self-signed one in controller.pki.key_dir at its first start, and uses it after that; a metrics server and the NATS server need one.

func (ServerTLS) Config added in v0.3.0

func (s ServerTLS) Config() (*tls.Config, error)

Config is the TLS config that a server with s serves, a metrics server or the NATS server: its certificate, or nil when s is not enabled. Neither has a self-signed fallback, so TLS on with no certificate is an error. The server reads the certificate again when its files change, at the next handshake: a certificate that a rotation or the operator replaces takes effect with no restart.

func (ServerTLS) WithCurrentSelfSigned added in v0.3.0

func (s ServerTLS) WithCurrentSelfSigned(
	dir string,
	name string,
) (ServerTLS, error)

WithCurrentSelfSigned is WithSelfSigned, except that a self-signed certificate that does not name this host's hostname now is made again: a renamed host, whose metrics certificate named its old name, gets one for its new name at its next start (osapi-io/osapi#1493). Only a certificate that nothing pins may change this way: not NATS's, which each join string pins, nor the API's, which clients on other hosts trust.

func (ServerTLS) WithSelfSigned added in v0.3.0

func (s ServerTLS) WithSelfSigned(
	dir string,
	name string,
	urls ...string,
) (ServerTLS, error)

WithSelfSigned is s with a certificate: its own cert_file, or, when TLS is on and it names none, the self-signed certificate name in dir, which it makes when it does not exist, for this host, localhost and the hosts of urls. A certificate that s names later replaces it with no other change.

type SigningKey added in v0.3.0

type SigningKey struct {
	// ID names the key in the kid header of each token that it signs.
	ID string `mapstructure:"id" validate:"required"`
	// Key is the HS256 key. Must be at least validation.MinSigningKeyLen
	// characters (see openssl rand -hex 32).
	Key string `mapstructure:"key" validate:"required,signing_key" mask:"password"`
}

SigningKey is one key of controller.api.security.signing_keys.

type Telemetry

type Telemetry struct {
	Tracing TracingConfig `mapstructure:"tracing,omitempty"`
}

Telemetry configuration settings.

type TracingConfig

type TracingConfig struct {
	// Enabled enables or disables tracing.
	Enabled bool `mapstructure:"enabled" doc:"Enable distributed tracing."`
	// Exporter selects the trace exporter: "stdout" or "otlp".
	Exporter string `mapstructure:"exporter" doc:"Trace exporter: 'stdout' or 'otlp'." choice:"empty sends no trace"`
	// OTLPEndpoint is the gRPC endpoint for the OTLP exporter (e.g., "localhost:4317").
	OTLPEndpoint string `` /* 160-byte string literal not displayed */
	// URL is where a person views the traces, such as a Jaeger UI. Health
	// links to it, and the controller reads a trace from its query API for
	// osapi client telemetry trace get. osapi does not run the backend.
	URL string `` /* 279-byte string literal not displayed */
	// TLS is how osapi checks the tracing backend: the OTLP exporter, and
	// the controller's reads of its query API at url.
	TLS ClientTLS `mapstructure:"tls"`
}

TracingConfig configuration settings for distributed tracing.

type UIConfig

type UIConfig struct {
	// Enabled controls whether the embedded UI is served. Defaults to true.
	Enabled bool `mapstructure:"enabled" doc:"Serve the embedded UI."`
	// URL is where a person opens the UI. Health shows it beside the bind
	// address of the API, whose listener serves the UI.
	URL string `` /* 189-byte string literal not displayed */
}

UIConfig holds settings for the embedded management UI.

func (UIConfig) UIEnabled

func (c UIConfig) UIEnabled() bool

UIEnabled reports whether the controller serves the embedded UI. Its default, true, is in controller start's defaults.

Jump to

Keyboard shortcuts

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