config

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultPath

func DefaultPath() (string, error)

DefaultPath returns the OS-specific default path for settings.json.

Types

type ClientSettings

type ClientSettings struct {
	NoColor            *bool     `json:"no-color,omitempty"`
	Quiet              *bool     `json:"quiet,omitempty"`
	ExpiryWarning      *int      `json:"expiry-warning,omitempty"`
	Output             *string   `json:"output,omitempty"`
	CACert             *string   `json:"cacert,omitempty"`
	Proxy              *string   `json:"proxy,omitempty"`
	File               *string   `json:"file,omitempty"`
	TLSVersions        *bool     `json:"tls-versions,omitempty"`
	ServerName         *string   `json:"servername,omitempty"`
	StartTLS           *string   `json:"starttls,omitempty"`
	Revocation         *string   `json:"revocation,omitempty"`
	RevocationTimeout  *Duration `json:"revocation-timeout,omitempty"`
	RevocationSoftFail *bool     `json:"revocation-soft-fail,omitempty"`
}

ClientSettings holds settings for the client subcommand.

type Duration

type Duration struct {
	time.Duration
}

Duration is a time.Duration that unmarshals from a JSON string like "5s".

func (Duration) MarshalJSON

func (d Duration) MarshalJSON() ([]byte, error)

func (*Duration) UnmarshalJSON

func (d *Duration) UnmarshalJSON(b []byte) error

type GlobalSettings

type GlobalSettings struct {
	NoColor            *bool     `json:"no-color,omitempty"`
	Quiet              *bool     `json:"quiet,omitempty"`
	ExpiryWarning      *int      `json:"expiry-warning,omitempty"`
	Output             *string   `json:"output,omitempty"`
	CACert             *string   `json:"cacert,omitempty"`
	Revocation         *string   `json:"revocation,omitempty"`
	RevocationTimeout  *Duration `json:"revocation-timeout,omitempty"`
	RevocationSoftFail *bool     `json:"revocation-soft-fail,omitempty"`
}

GlobalSettings holds settings that apply to all subcommands.

type PemSettings

type PemSettings struct {
	NoColor            *bool     `json:"no-color,omitempty"`
	Quiet              *bool     `json:"quiet,omitempty"`
	ExpiryWarning      *int      `json:"expiry-warning,omitempty"`
	Output             *string   `json:"output,omitempty"`
	CACert             *string   `json:"cacert,omitempty"`
	Revocation         *string   `json:"revocation,omitempty"`
	RevocationTimeout  *Duration `json:"revocation-timeout,omitempty"`
	RevocationSoftFail *bool     `json:"revocation-soft-fail,omitempty"`
}

PemSettings holds settings for the pem subcommand.

type Settings

type Settings struct {
	Global GlobalSettings `json:"global"`
	Client ClientSettings `json:"client"`
	Pem    PemSettings    `json:"pem"`
}

Settings represents the full configuration file.

func Load

func Load(path string, explicit bool) (*Settings, error)

Load reads and parses a settings.json file from the given path. If explicit is true, a missing file is treated as an error. If explicit is false (default path), a missing file returns empty settings.

func (*Settings) FlagValues

func (s *Settings) FlagValues(subcommand string) map[string]string

FlagValues returns a map of flag-name to string-value for the given subcommand section. Only non-nil fields are included.

Jump to

Keyboard shortcuts

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