Documentation
¶
Index ¶
Constants ¶
const ( AuthTypePAT = "pat" // default; omitted from YAML for existing profiles AuthTypeSSO = "sso" // OAuth2 JWT obtained via browser login )
const ( UserTypeUser = "USER" // a PAT or SSO-authenticated human user UserTypeServiceAccount = "SERVICE_ACCOUNT" // a SAT-authenticated service account )
UserType identifies the kind of principal a profile's token belongs to.
Variables ¶
This section is empty.
Functions ¶
func AnyProfileMatchesDomain ¶
AnyProfileMatchesDomain reports whether any profile's email belongs to domain. Returns false on any error (missing file, parse failure, no email set).
func GetOrCreateTelemetryID ¶
GetOrCreateTelemetryID returns the stable anonymous telemetry UUID from config. If one is already on disk, it's reused regardless of isTTY — that means some interactive run persisted it before, so it's a real machine identity. Otherwise, a new UUID is only minted when isTTY is true, and only returned if it's successfully persisted — an unpersisted ID would just be re-minted next run, inflating user counts with one-off IDs. Non-interactive runs with no existing ID, and any case where persistence fails, fall back to [sentinelTelemetryID]. Errors are silently ignored — callers should fall back to a session-scoped ID rather than blocking startup.
func SaveConfig ¶
Types ¶
type AuthType ¶
type AuthType = string
AuthType identifies how the token in the credentials file was obtained. Empty string (existing profiles) is treated as AuthTypePAT.
type Config ¶
type Config struct {
Profiles map[string]*Profile `yaml:"profiles"`
DisableTelemetry bool `yaml:"disable_telemetry,omitempty"`
TelemetryID string `yaml:"telemetry_id,omitempty"`
EnabledModules []string `yaml:"enabled_modules,omitempty"` // hidden modules enabled via `install module <name>`
}
func LoadConfig ¶
type Profile ¶
type Profile struct {
APIUrl string `yaml:"api_url"`
UIUrl string `yaml:"ui_url,omitempty"` // Harness UI base URL; set for SSO profiles from JWT subdomain
AccountID string `yaml:"account_id"`
OrgID string `yaml:"org_id,omitempty"`
ProjectID string `yaml:"project_id,omitempty"`
RegistryURL string `yaml:"registry_url,omitempty"`
AuthType AuthType `yaml:"auth_type,omitempty"` // omitted for existing PAT profiles
Email string `yaml:"email,omitempty"` // user email; populated on login/status, empty for legacy profiles
UserType string `yaml:"user_type,omitempty"` // UserTypeUser or UserTypeServiceAccount; empty for legacy profiles or when undetermined (e.g. SSO)
UserID string `yaml:"user_id,omitempty"` // Harness user uuid; set when UserType == UserTypeUser
ServiceAccountID string `yaml:"service_account_id,omitempty"` // service account's own identifier (SATs have no uuid); set when UserType == UserTypeServiceAccount
}