Documentation
¶
Overview ¶
Package config persists mmcli connection contexts in a JSON file under the user's XDG config dir. Secrets (password, cached token) are NOT stored here — they live in the keyring (see internal/secrets).
Index ¶
Constants ¶
const AuthToken = "token"
AuthToken marks a context authenticated by a personal access token.
Variables ¶
var ErrNoContext = errors.New("no context configured; run `mmcli login` first")
ErrNoContext means no context is selected / configured yet.
Functions ¶
func DefaultPath ¶
DefaultPath returns the config file location, honoring XDG_CONFIG_HOME.
Types ¶
type Config ¶
type Config struct {
CurrentName string `json:"current"`
Contexts map[string]Context `json:"contexts"`
// contains filtered or unexported fields
}
Config is the on-disk document. The file path is kept separately and is not serialized.
func Load ¶
Load reads the config at path. A missing file yields an empty, ready-to-use Config rather than an error.
type Context ¶
type Context struct {
URL string `json:"url"`
LoginID string `json:"login_id"`
DefaultTeam string `json:"default_team,omitempty"`
// Auth is AuthToken for personal access token contexts (bot accounts
// cannot log in with a password); empty means login_id/password.
Auth string `json:"auth,omitempty"`
}
Context holds non-secret connection parameters for one Mattermost server.