package config import ( "time" bftconfig "github.com/cometbft/cometbft/config" ) type UnifiedConfig struct { *bftconfig.Config `mapstructure:",squash"` PLC *PLCConfig `mapstructure:"plc"` } func DefaultConfig() *UnifiedConfig { return &UnifiedConfig{ Config: bftconfig.DefaultConfig(), PLC: DefaultPLCConfig(), } } type PLCConfig struct { // Address to listen for incoming connections ListenAddress string `mapstructure:"laddr"` // Whether to expose pprof endpoints for debugging Pprof bool `mapstructure:"pprof"` // Maximum age of a cursor for the streaming export endpoint. // If set to 0, the OutdatedCursor error is disabled entirely. MaxStreamingExportCursorAge time.Duration `mapstructure:"max_streaming_export_cursor_age"` // Server response timeout for API endpoints ResponseTimeout time.Duration `mapstructure:"response_timeout"` // SnapshotInterval defines the number of blocks between automatic snapshots. // If set to 0, automatic snapshot creation is disabled. SnapshotInterval uint64 `mapstructure:"snapshot_interval"` // SnapshotRetentionCount defines the maximum number of snapshots to retain. // When creating a new snapshot, older snapshots are automatically deleted. // If set to 0, all snapshots are retained. SnapshotRetentionCount uint64 `mapstructure:"snapshot_retention_count"` } func DefaultPLCConfig() *PLCConfig { return &PLCConfig{ ListenAddress: "tcp://127.0.0.1:28080", Pprof: true, // TODO set to false once we move past alpha phase MaxStreamingExportCursorAge: 7 * 24 * time.Hour, ResponseTimeout: 10 * time.Second, SnapshotInterval: 0, // Disable snapshots by default SnapshotRetentionCount: 1, } }