Documentation
¶
Overview ¶
Package config stores named profiles in ~/.config/gyro/config.toml (0600), aws-style.
default_profile = "default" [profiles.default] api_url = "https://www.gyrohosting.com/api/v1/client" token = "wck_..." # or token_storage = "keyring" (token lives in the OS keychain) output = "table" lang = "tr"
Precedence: command-line flag > environment (GYRO_TOKEN, GYRO_PROFILE, GYRO_API_URL, GYRO_OUTPUT, GYRO_LANG) > profile > built-in default.
Index ¶
- func Path() string
- type File
- func (f *File) ActiveName(flag string) string
- func (f *File) Delete(name string)
- func (f *File) FilePath() string
- func (f *File) Get(name string) *Profile
- func (f *File) InsecurePerms() bool
- func (f *File) ProfileNames() []string
- func (f *File) Save() error
- func (f *File) SetToken(name, token string, useKeyring bool) error
- func (f *File) TokenFor(name string) (token, source string, err error)
- type Profile
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type File ¶
type File struct {
DefaultProfile string `toml:"default_profile,omitempty"`
Profiles map[string]*Profile `toml:"profiles"`
// contains filtered or unexported fields
}
File is the whole config file.
func (*File) ActiveName ¶
ActiveName resolves the profile name: flag > GYRO_PROFILE > default_profile > "default".
func (*File) InsecurePerms ¶
InsecurePerms reports a config file readable by group/others (unix only).
func (*File) ProfileNames ¶
ProfileNames returns the sorted profile names.
type Profile ¶
type Profile struct {
APIURL string `toml:"api_url,omitempty"`
Token string `toml:"token,omitempty"`
TokenStorage string `toml:"token_storage,omitempty"` // "" / "file" | "keyring"
Output string `toml:"output,omitempty"`
Lang string `toml:"lang,omitempty"`
SSHUser string `toml:"ssh_user,omitempty"`
SSHIdentity string `toml:"ssh_identity,omitempty"`
}
Profile is one named set of credentials and preferences.