Documentation
¶
Index ¶
- func GetFingerprintDir() (string, error)
- func GetFingerprintFilePath() (string, error)
- func GetPangolinConfigDir() (string, error)
- func WithAccountStore(ctx context.Context, store *AccountStore) context.Context
- func WithConfig(ctx context.Context, store *Config) context.Context
- type Account
- type AccountStore
- func (s *AccountStore) ActiveAccount() (*Account, error)
- func (s *AccountStore) AvailableAccounts() []Account
- func (s *AccountStore) Deactivate(userID string) error
- func (s *AccountStore) Save() error
- func (s *AccountStore) UpdateAccountUserInfo(userID, username, name string) error
- func (s *AccountStore) UpdateActiveAccount(account *Account) error
- type Config
- type OlmCredentials
- type ServerInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetFingerprintDir ¶
GetFingerprintDir returns the directory for storing the platform fingerprint. On Linux, this uses /etc/pangolin since the fingerprint is machine-specific and needs to be written by a privileged process but readable by all users. On other platforms, it falls back to the user config directory.
func GetFingerprintFilePath ¶
GetFingerprintFilePath returns the full path to the platform fingerprint file.
func GetPangolinConfigDir ¶
GetPangolinConfigDir returns the path to the .pangolin directory and ensures it exists
func WithAccountStore ¶
func WithAccountStore(ctx context.Context, store *AccountStore) context.Context
Types ¶
type Account ¶
type Account struct {
UserID string `mapstructure:"userId" json:"userId"`
Host string `mapstructure:"host" json:"host"`
Email string `mapstructure:"email" json:"email"`
Username *string `mapstructure:"username" json:"username,omitempty"`
Name *string `mapstructure:"name" json:"name,omitempty"`
SessionToken string `mapstructure:"sessionToken" json:"sessionToken"`
OrgID string `mapstructure:"orgId" json:"orgId,omitempty"`
OlmCredentials *OlmCredentials `mapstructure:"olmCredentials" json:"olmCredentials,omitempty"`
ServerInfo *ServerInfo `mapstructure:"serverInfo" json:"serverInfo,omitempty"`
}
type AccountStore ¶
type AccountStore struct {
ActiveUserID string `mapstructure:"activeUserId" json:"activeUserId"`
Accounts map[string]Account `mapstructure:"accounts" json:"accounts"`
// contains filtered or unexported fields
}
func AccountStoreFromContext ¶
func AccountStoreFromContext(ctx context.Context) *AccountStore
func LoadAccountStore ¶
func LoadAccountStore() (*AccountStore, error)
func (*AccountStore) ActiveAccount ¶
func (s *AccountStore) ActiveAccount() (*Account, error)
func (*AccountStore) AvailableAccounts ¶
func (s *AccountStore) AvailableAccounts() []Account
Return a list of accounts that are available to use. These accounts are guaranteed to have a valid session token.
func (*AccountStore) Deactivate ¶
func (s *AccountStore) Deactivate(userID string) error
Set account with the user ID as "inactive"; keeps the Olm credentials for the account, but clear other account state like the session token and selected org ID.
This effectively logs out the account.
func (*AccountStore) Save ¶
func (s *AccountStore) Save() error
func (*AccountStore) UpdateAccountUserInfo ¶
func (s *AccountStore) UpdateAccountUserInfo(userID, username, name string) error
UpdateAccountUserInfo updates the username and name for a specific account
func (*AccountStore) UpdateActiveAccount ¶
func (s *AccountStore) UpdateActiveAccount(account *Account) error
UpdateActiveAccount updates the active account in the store. This must be called after modifying an account obtained from ActiveAccount() because Go maps return copies of values, not references.
type Config ¶
type Config struct {
LogLevel logger.LogLevel `mapstructure:"log_level" json:"log_level"`
LogFile string `mapstructure:"log_file" json:"log_file"`
DisableUpdateCheck bool `mapstructure:"disable_update_check" json:"disable_update_check"`
// contains filtered or unexported fields
}
func ConfigFromContext ¶
func LoadConfig ¶
type OlmCredentials ¶
type ServerInfo ¶
type ServerInfo struct {
Version string `mapstructure:"version" json:"version"`
SupporterStatusValid bool `mapstructure:"supporterStatusValid" json:"supporterStatusValid"`
Build string `mapstructure:"build" json:"build"` // "oss" | "enterprise" | "saas"
EnterpriseLicenseValid bool `mapstructure:"enterpriseLicenseValid" json:"enterpriseLicenseValid"`
EnterpriseLicenseType *string `mapstructure:"enterpriseLicenseType" json:"enterpriseLicenseType,omitempty"`
}
ServerInfo represents server information including version, build type, and license status This mirrors api.ServerInfo to avoid import cycles