Documentation
¶
Overview ¶
Package setup provides reusable broker setup command primitives.
Index ¶
- func BindSystemdFlags(fs *flag.FlagSet, opts *SystemdOptions)
- func ConfigureClient(stdout io.Writer, opts ClientOptions) (string, error)
- func GenerateSecret() (string, error)
- func ResolveSecret(source SecretInput, stdin io.Reader) (string, error)
- type ClientDefaults
- type ClientOptions
- type SecretInput
- type SystemdDefaults
- type SystemdOptions
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 ¶
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 ¶
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 ¶
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
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.