Documentation
¶
Overview ¶
Package config resolves linkedin configuration with a manual flag > env > file > default precedence (no Viper, per the cliwright house pattern). LinkedIn's public API needs no credentials, so a profile is optional; when present it holds only non-secret settings (host overrides, whether a bearer token is stored). Any token lives in the OS keyring.
Index ¶
Constants ¶
const DefaultProfile = "default"
DefaultProfile is used when no profile is selected anywhere.
Variables ¶
This section is empty.
Functions ¶
func Dir ¶
Dir returns the configuration directory: $XDG_CONFIG_HOME/linkedin if set, else ~/.linkedin-cli.
func FirstNonEmpty ¶
FirstNonEmpty returns the first non-empty string — the manual precedence helper used across linkedin instead of a config framework.
func ValidateBaseURL ¶
ValidateBaseURL requires an http/https URL with a host and rejects cleartext http:// for a non-loopback host.
func ValidateProfileName ¶
ValidateProfileName rejects empty names and traversal-dangerous characters.
Types ¶
type Config ¶
type Config struct {
CurrentProfile string `yaml:"current_profile,omitempty"`
Profiles map[string]Profile `yaml:"profiles,omitempty"`
Aliases map[string]string `yaml:"aliases,omitempty"`
// contains filtered or unexported fields
}
Config is the on-disk configuration.
func (*Config) ProfileNames ¶
ProfileNames returns the profile names (unsorted; callers sort for display).
func (*Config) ResolveProfileName ¶
ResolveProfileName applies precedence: explicit flag > LINKEDIN_PROFILE > current_profile > default.
type Profile ¶
type Profile struct {
VoyagerBaseURL string `yaml:"voyager_base_url,omitempty" json:"voyager_base_url,omitempty"`
WebBaseURL string `yaml:"web_base_url,omitempty" json:"web_base_url,omitempty"`
HasCookies bool `yaml:"has_cookies,omitempty" json:"has_cookies,omitempty"` // a session cookie pair is stored in the keyring
CookieSource string `yaml:"cookie_source,omitempty" json:"cookie_source,omitempty"` // where the stored cookies came from (e.g. "chrome (Default)")
}
Profile holds the non-secret settings for one LinkedIn context. The optional bearer token lives in the keyring under this profile's key, never here.