Documentation
¶
Index ¶
- func AdderConfigPath() string
- func ConfigDir() string
- func ConfigExists() bool
- func ConfigPath() string
- func GenerateAdderConfig(params AdderConfigParams) ([]byte, error)
- func LogDir() string
- func SaveConfig(cfg TrayConfig) error
- func WriteAdderConfig(params AdderConfigParams) error
- type AdderConfigParams
- type App
- type MonitorTemplate
- type ProcessManager
- type ProcessManagerOption
- type TrayConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AdderConfigPath ¶
func AdderConfigPath() string
AdderConfigPath returns the path to the adder config file in the config directory.
func ConfigDir ¶
func ConfigDir() string
ConfigDir returns the platform-specific directory for storing configuration files.
func ConfigExists ¶
func ConfigExists() bool
ConfigExists reports whether the configuration file exists on disk.
func ConfigPath ¶
func ConfigPath() string
ConfigPath returns the full path to the tray configuration file.
func GenerateAdderConfig ¶
func GenerateAdderConfig(params AdderConfigParams) ([]byte, error)
GenerateAdderConfig builds an adder configuration from the given parameters. The API server is always enabled because adder-tray connects to its /events endpoint for desktop notifications and /healthcheck for status monitoring.
func LogDir ¶
func LogDir() string
LogDir returns the platform-specific directory for storing log files.
func SaveConfig ¶
func SaveConfig(cfg TrayConfig) error
SaveConfig writes the tray configuration to disk, creating the config directory if necessary.
func WriteAdderConfig ¶
func WriteAdderConfig(params AdderConfigParams) error
WriteAdderConfig writes the adder configuration to the config directory.
Types ¶
type AdderConfigParams ¶
type AdderConfigParams struct {
Network string
Template MonitorTemplate
Param string // The address/drep/pool value depending on Template
Output string // Output plugin name (default: "log")
Format string // Output format (default: "json")
}
AdderConfigParams holds the parameters for generating an adder configuration.
type App ¶
type App struct {
// contains filtered or unexported fields
}
App holds references to all major components of the tray application.
type MonitorTemplate ¶
type MonitorTemplate int
MonitorTemplate represents a pre-configured monitoring template.
const ( WatchWallet MonitorTemplate = iota TrackDRep MonitorPool )
func (MonitorTemplate) String ¶
func (t MonitorTemplate) String() string
String returns the display name of the template.
type ProcessManager ¶
type ProcessManager struct {
// contains filtered or unexported fields
}
ProcessManager manages the lifecycle of the adder subprocess.
func NewProcessManager ¶
func NewProcessManager( opts ...ProcessManagerOption, ) *ProcessManager
NewProcessManager creates a new ProcessManager with the given options.
func (*ProcessManager) IsRunning ¶
func (pm *ProcessManager) IsRunning() bool
IsRunning reports whether the adder process is currently running.
func (*ProcessManager) Restart ¶
func (pm *ProcessManager) Restart() error
Restart stops and then starts the adder process.
func (*ProcessManager) Start ¶
func (pm *ProcessManager) Start() error
Start launches the adder process. Returns an error if it is already running.
func (*ProcessManager) Stop ¶
func (pm *ProcessManager) Stop() error
Stop terminates the running adder process gracefully.
type ProcessManagerOption ¶
type ProcessManagerOption func(*ProcessManager)
ProcessManagerOption is a functional option for ProcessManager.
func WithBinary ¶
func WithBinary(path string) ProcessManagerOption
WithBinary sets the path to the adder binary.
func WithConfigFile ¶
func WithConfigFile(path string) ProcessManagerOption
WithConfigFile sets the path to the adder configuration file.
type TrayConfig ¶
type TrayConfig struct {
// AdderBinary is the path to the adder binary.
AdderBinary string `yaml:"adder_binary"`
// AdderConfig is the path to the adder configuration file.
AdderConfig string `yaml:"adder_config"`
// AutoStart controls whether adder starts automatically
// with the tray application.
AutoStart bool `yaml:"auto_start"`
}
TrayConfig holds the configuration for the adder-tray application.
func DefaultConfig ¶
func DefaultConfig() TrayConfig
DefaultConfig returns a TrayConfig with sensible defaults.
func LoadConfig ¶
func LoadConfig() (TrayConfig, error)
LoadConfig reads the tray configuration from disk. If the file does not exist, it returns the default configuration.