clientconfig

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: 12 Imported by: 0

Documentation

Overview

Package clientconfig writes per-client broker environment files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Path

func Path(homeDir string, brokerName string) (string, error)

Path returns the default client.env path for cfg.

func Render

func Render(cfg Config) ([]byte, error)

Render returns shell-compatible environment assignments for cfg.

func SecretFromData

func SecretFromData(data []byte, client string) (string, error)

SecretFromData parses `name = secret` data and returns client's secret.

func SecretFromFile

func SecretFromFile(path string, client string) (string, error)

SecretFromFile reads path and returns the configured secret for client.

func SecretsFromData

func SecretsFromData(data []byte) (map[string]string, error)

SecretsFromData parses `name = secret` data and returns all configured client secrets.

func SecretsFromFile

func SecretsFromFile(path string) (map[string]string, error)

SecretsFromFile reads path and returns all configured client secrets.

func ValidateClientName

func ValidateClientName(value string) error

ValidateClientName validates an identifier used as a client secret-file key.

func ValidateURL

func ValidateURL(value string) error

ValidateURL validates a broker client URL and rejects embedded credentials.

func Write

func Write(cfg Config) (string, error)

Write writes cfg to ~/.config/<broker>/client.env and returns the path.

func WriteForHomeOwner

func WriteForHomeOwner(cfg Config) (string, error)

WriteForHomeOwner writes cfg and, when running as root, makes the generated client config paths owned by the owner of cfg.HomeDir.

Types

type Config

type Config struct {
	BrokerName string
	EnvPrefix  string
	URL        string
	Secret     string
	HomeDir    string
}

Config describes one broker client environment file.

Jump to

Keyboard shortcuts

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