Documentation
¶
Overview ¶
Package settings contains the logic for reading, writing, associating profiles with a user's settings file. It also configures a Phobos SDK client.
Index ¶
Constants ¶
const (
// DefaultProfileName is the name of the default profile
DefaultProfileName = "default"
)
Variables ¶
var ErrNoSettings = errors.New(noSettingsMessage)
ErrNoSettings is a special error if settings file does not exist.
Functions ¶
func DefaultCredentialsFilepath ¶
DefaultCredentialsFilepath returns the OS-dependent path/name of the default credentials file.
Types ¶
type Profile ¶
type Profile struct {
Token *string `json:"-"` // Not persistent, written via creds struct above!
Endpoint string `json:"endpoint"` // HTTP.
TLSSkipVerify bool `json:"tlsSkipVerify"`
}
Profile holds the contents of one profile from a settings file.
type Settings ¶
type Settings struct {
Profiles map[string]Profile `json:"profiles"`
CurrentProfile *Profile `json:"-"` // This field is not persistent, do not write it out.
}
Settings holds the contents of one settings file and a pointer to the profile specified by the current command.
func ReadSettings ¶
ReadSettings reads the settings file. If no argument, it reads the default settings file: ~/.phobos/settings.json
func (*Settings) SetCurrentProfile ¶
SetCurrentProfile sets the current profile pointer in a settings object.
func (*Settings) WriteSettingsFile ¶
WriteSettingsFile writes the settings file. If no filename argument, it writes the default settings file: ~/.phobos/settings.json