Documentation
¶
Index ¶
- Constants
- func ApplyEnvConfig(cfg *Config, changed map[string]bool) error
- func ApplyFileConfig(cfg *Config, fc fileConfig, changed map[string]bool) error
- func DefaultConfigPath() string
- func FileExists(p string) bool
- func LoadFileConfig(path string) (fileConfig, error)
- func LoadNodeInfo(cfg *Config) error
- func Logger() zerolog.Logger
- func Run(ctx context.Context, cfg Config) error
- type Config
- type ConfigWatcher
- type FrameMeta
Constants ¶
const ( ErrCodeFileNotFound = "FILE_NOT_FOUND" ErrCodePermissionDenied = "PERMISSION_DENIED" ErrCodeReadError = "READ_ERROR" )
const DefaultServiceURL = "https://api.apphash.io"
DefaultServiceURL is the default endpoint for shipping WAL data.
Variables ¶
This section is empty.
Functions ¶
func ApplyEnvConfig ¶
ApplyEnvConfig applies configuration from environment variables (WALSHIP_*). It respects flags that have been explicitly set (changed map). Returns error if any environment variable has an invalid format.
func ApplyFileConfig ¶
ApplyFileConfig applies configuration from a file to the Config struct. It respects flags that have been explicitly set (changed map).
func DefaultConfigPath ¶
func DefaultConfigPath() string
DefaultConfigPath returns the default configuration file path.
func FileExists ¶
FileExists checks if a file exists at the given path.
func LoadFileConfig ¶
LoadFileConfig reads and parses a TOML config file from the given path.
func LoadNodeInfo ¶
LoadNodeInfo resolves ChainID and NodeID from explicit config or by querying the chain binary. It never reads private key material from disk.
Resolution order for each field:
- Already set via flag / env / config file — keep as-is.
- ChainBinaryPath is set — query the binary.
- Neither — return an actionable error.
Types ¶
type Config ¶
type Config struct {
NodeHome string
NodeID string
WALDir string
ChainBinaryPath string
ChainID string
ServiceURL string
AuthKey string
PollInterval time.Duration
SendInterval time.Duration
HardInterval time.Duration
HTTPTimeout time.Duration
CPUThreshold float64
NetThreshold float64
Iface string
IfaceSpeedMbps int
MaxBatchBytes int
StateDir string
Verify bool
Meta bool
Once bool
}
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns a Config with default values.
type ConfigWatcher ¶
type ConfigWatcher struct {
// contains filtered or unexported fields
}
ConfigWatcher monitors app.toml and config.toml changes via fsnotify.
func NewConfigWatcher ¶
func NewConfigWatcher(cfg *Config) *ConfigWatcher
func (*ConfigWatcher) Run ¶
func (w *ConfigWatcher) Run(ctx context.Context)
Run watches $NODE_HOME/config and sends updates to {ServiceURL}/config.
type FrameMeta ¶
type FrameMeta struct {
File string `json:"file"`
Frame uint64 `json:"frame"`
Off uint64 `json:"off"`
Len uint64 `json:"len"`
Recs uint32 `json:"recs"`
FirstTS int64 `json:"first_ts"`
LastTS int64 `json:"last_ts"`
CRC32 uint32 `json:"crc32"`
}
FrameMeta matches tools/memlogger/writer.go schema for index lines. Fields are used to locate and read gzip members from the .gz file.