setup

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package setup provides reusable broker setup command primitives.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BindSystemdFlags

func BindSystemdFlags(fs *flag.FlagSet, opts *SystemdOptions)

BindSystemdFlags adds the shared setup systemd flags to fs.

func ConfigureClient

func ConfigureClient(stdout io.Writer, opts ClientOptions) (string, error)

ConfigureClient writes the client environment and prints only non-secret setup metadata.

func GenerateSecret

func GenerateSecret() (string, error)

GenerateSecret returns a 256-bit random secret encoded as lowercase hex.

func ResolveSecret

func ResolveSecret(source SecretInput, stdin io.Reader) (string, error)

ResolveSecret reads or generates a secret without printing it.

Types

type ClientDefaults

type ClientDefaults struct {
	BrokerName string
	EnvPrefix  string
	ClientName string
}

ClientDefaults configures the shared setup client command.

type ClientOptions

type ClientOptions struct {
	BrokerName string
	EnvPrefix  string
	ClientName string
	URL        string
	SecretFile string
	HomeDir    string
}

ClientOptions is one parsed setup client request.

func ParseClient

func ParseClient(stderr io.Writer, args []string, defaults ClientDefaults) (opts ClientOptions, help bool, err error)

ParseClient parses the broker-family setup client flags. Help is true when flag help was printed and no setup should run.

func (ClientOptions) Validate

func (opts ClientOptions) Validate() error

Validate validates one setup client request.

type SecretInput

type SecretInput struct {
	File  string
	Stdin bool
}

SecretInput describes one file, stdin, or generated secret source.

type SystemdDefaults

type SystemdDefaults struct {
	BrokerName string
	User       string
	Group      string
	ClientName string
	BindAddr   string
	Port       int
}

SystemdDefaults configures shared Linux service setup flags.

type SystemdOptions

type SystemdOptions struct {
	BrokerName        string
	User              string
	Group             string
	ConfigDir         string
	StateDir          string
	SystemdDir        string
	BinaryPath        string
	ClientName        string
	SharedSecretFile  string
	SharedSecretStdin bool
	BindAddr          string
	Port              int
	DryRun            bool
	NoStart           bool
	AllowNonRoot      bool
}

SystemdOptions contains the broker-neutral service setup fields.

func DefaultSystemdOptions

func DefaultSystemdOptions(defaults SystemdDefaults) SystemdOptions

DefaultSystemdOptions returns the common broker-family Linux layout.

func FinalizeSystemd

func FinalizeSystemd(opts SystemdOptions) (SystemdOptions, error)

FinalizeSystemd resolves the current executable and validates opts.

func (SystemdOptions) ListenAddress

func (opts SystemdOptions) ListenAddress() string

ListenAddress returns bind address and port in net/http form.

func (SystemdOptions) Validate

func (opts SystemdOptions) Validate() error

Validate validates shared Linux service setup fields.

Jump to

Keyboard shortcuts

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