Documentation
¶
Overview ¶
Enhanced config.go for the client
Index ¶
- func GetConfigDir() (string, error)
- func GetConfigPath() (string, error)
- func GetKeystorePath() (string, error)
- func MigrateKeystoreToNewLocation() error
- func RunProfileSelection(profiles []ConnectionProfile) (int, error)
- func RunProfileSelectionWithNew(profiles []ConnectionProfile) (int, bool, error)
- func SaveConfig(path string, cfg Config) error
- type Config
- type ConfigUIModel
- func (m ConfigUIModel) GetConfig() *Config
- func (m ConfigUIModel) GetKeystorePassphrase() string
- func (m ConfigUIModel) Init() tea.Cmd
- func (m ConfigUIModel) IsCancelled() bool
- func (m ConfigUIModel) IsFinished() bool
- func (m ConfigUIModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (m ConfigUIModel) View() string
- type ConnectionProfile
- type InteractiveConfigLoader
- func (icl *InteractiveConfigLoader) AutoConnect() (*Config, error)
- func (icl *InteractiveConfigLoader) FormatSanitizedLaunchCommand(cfg *Config) string
- func (icl *InteractiveConfigLoader) LoadOrPromptConfig(overrides map[string]interface{}) (*Config, string, string, string, error)
- func (icl *InteractiveConfigLoader) LoadProfiles() (*Profiles, error)
- func (icl *InteractiveConfigLoader) PromptSensitiveData(isAdmin, useE2E bool) (adminKey, keystorePass string, err error)
- func (icl *InteractiveConfigLoader) QuickStartConnect() (*Config, error)
- func (icl *InteractiveConfigLoader) SaveProfiles(profiles *Profiles) error
- type ProfileSelectionModel
- func (m ProfileSelectionModel) GetChoice() int
- func (m ProfileSelectionModel) Init() tea.Cmd
- func (m ProfileSelectionModel) IsCancelled() bool
- func (m ProfileSelectionModel) IsCreateNew() bool
- func (m ProfileSelectionModel) IsSelected() bool
- func (m ProfileSelectionModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (m ProfileSelectionModel) View() string
- type Profiles
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetConfigDir ¶
GetConfigDir returns the platform-appropriate configuration directory
func GetConfigPath ¶
GetConfigPath returns the full path to the config file
func GetKeystorePath ¶
GetKeystorePath returns the full path to the keystore file Checks old location (current directory) first for backward compatibility
func MigrateKeystoreToNewLocation ¶
func MigrateKeystoreToNewLocation() error
MigrateKeystoreToNewLocation migrates keystore from legacy location to new platform-appropriate location
func RunProfileSelection ¶
func RunProfileSelection(profiles []ConnectionProfile) (int, error)
RunProfileSelection runs the profile selection UI (for quick-start)
func RunProfileSelectionWithNew ¶
func RunProfileSelectionWithNew(profiles []ConnectionProfile) (int, bool, error)
RunProfileSelectionWithNew runs the profile selection UI with "Create New" option
func SaveConfig ¶
Types ¶
type Config ¶
type Config struct {
// Connection settings
Username string `json:"username"`
ServerURL string `json:"server_url"`
// Admin settings (optional)
IsAdmin bool `json:"is_admin,omitempty"`
AdminKey string `json:"admin_key,omitempty"` // Note: Consider security implications
// E2E Encryption settings (optional)
UseE2E bool `json:"use_e2e,omitempty"`
// UI settings
Theme string `json:"theme"`
TwentyFourHour bool `json:"twenty_four_hour"`
SkipTLSVerify bool `json:"skip_tls_verify,omitempty"`
// Quick start settings
SaveCredentials bool `json:"save_credentials"`
LastUsed int64 `json:"last_used,omitempty"`
}
func LoadConfig ¶
func RunInteractiveConfig ¶
RunInteractiveConfig runs the interactive configuration UI
type ConfigUIModel ¶
type ConfigUIModel struct {
// contains filtered or unexported fields
}
func NewConfigUI ¶
func NewConfigUI() ConfigUIModel
func (ConfigUIModel) GetConfig ¶
func (m ConfigUIModel) GetConfig() *Config
GetConfig returns the built configuration
func (ConfigUIModel) GetKeystorePassphrase ¶
func (m ConfigUIModel) GetKeystorePassphrase() string
GetKeystorePassphrase returns the keystore passphrase
func (ConfigUIModel) Init ¶
func (m ConfigUIModel) Init() tea.Cmd
func (ConfigUIModel) IsCancelled ¶
func (m ConfigUIModel) IsCancelled() bool
IsCancelled returns true if the user cancelled the configuration
func (ConfigUIModel) IsFinished ¶
func (m ConfigUIModel) IsFinished() bool
IsFinished returns true if the user completed the configuration
func (ConfigUIModel) View ¶
func (m ConfigUIModel) View() string
type ConnectionProfile ¶
type ConnectionProfile struct {
Name string `json:"name"`
ServerURL string `json:"server_url"`
Username string `json:"username"`
IsAdmin bool `json:"is_admin"`
UseE2E bool `json:"use_e2e"`
Theme string `json:"theme,omitempty"`
LastUsed int64 `json:"last_used,omitempty"` // Unix timestamp
}
ConnectionProfile represents a saved connection profile
type InteractiveConfigLoader ¶
type InteractiveConfigLoader struct {
ConfigPath string
ProfilesPath string
// contains filtered or unexported fields
}
InteractiveConfigLoader handles interactive configuration
func NewInteractiveConfigLoader ¶
func NewInteractiveConfigLoader() (*InteractiveConfigLoader, error)
func (*InteractiveConfigLoader) AutoConnect ¶
func (icl *InteractiveConfigLoader) AutoConnect() (*Config, error)
AutoConnect automatically connects to the most recently used profile
func (*InteractiveConfigLoader) FormatSanitizedLaunchCommand ¶
func (icl *InteractiveConfigLoader) FormatSanitizedLaunchCommand(cfg *Config) string
FormatSanitizedLaunchCommand creates a version safe for logging (without sensitive data)
func (*InteractiveConfigLoader) LoadOrPromptConfig ¶
func (icl *InteractiveConfigLoader) LoadOrPromptConfig(overrides map[string]interface{}) (*Config, string, string, string, error)
LoadOrPromptConfig loads existing config or prompts for new configuration
func (*InteractiveConfigLoader) LoadProfiles ¶
func (icl *InteractiveConfigLoader) LoadProfiles() (*Profiles, error)
func (*InteractiveConfigLoader) PromptSensitiveData ¶
func (icl *InteractiveConfigLoader) PromptSensitiveData(isAdmin, useE2E bool) (adminKey, keystorePass string, err error)
PromptSensitiveData prompts for admin key and/or keystore passphrase
func (*InteractiveConfigLoader) QuickStartConnect ¶
func (icl *InteractiveConfigLoader) QuickStartConnect() (*Config, error)
QuickStartConnect shows profiles and connects to selected one
func (*InteractiveConfigLoader) SaveProfiles ¶
func (icl *InteractiveConfigLoader) SaveProfiles(profiles *Profiles) error
type ProfileSelectionModel ¶
type ProfileSelectionModel struct {
// contains filtered or unexported fields
}
ProfileSelectionModel handles profile selection UI
func NewProfileSelectionModel ¶
func NewProfileSelectionModel(profiles []ConnectionProfile, showNewOption bool) ProfileSelectionModel
func (ProfileSelectionModel) GetChoice ¶
func (m ProfileSelectionModel) GetChoice() int
func (ProfileSelectionModel) Init ¶
func (m ProfileSelectionModel) Init() tea.Cmd
func (ProfileSelectionModel) IsCancelled ¶
func (m ProfileSelectionModel) IsCancelled() bool
func (ProfileSelectionModel) IsCreateNew ¶
func (m ProfileSelectionModel) IsCreateNew() bool
IsCreateNew returns true if user selected "Create New Profile"
func (ProfileSelectionModel) IsSelected ¶
func (m ProfileSelectionModel) IsSelected() bool
func (ProfileSelectionModel) View ¶
func (m ProfileSelectionModel) View() string
type Profiles ¶
type Profiles struct {
Default string `json:"default,omitempty"`
Profiles []ConnectionProfile `json:"profiles"`
}