config

package
v1.2.7-beta Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 3, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadConfig

func LoadConfig(cfgFile string) error

Types

type APIConfig

type APIConfig struct {
	Host                string                   `mapstructure:"host"`
	BasicAuth           BasicAuthConfig          `mapstructure:"basicAuth"`
	ThirdwebContractApi string                   `mapstructure:"thirdwebContractApi"`
	ContractApiRequest  ContractApiRequestConfig `mapstructure:"contractApiRequest"`
	AbiDecodingEnabled  bool                     `mapstructure:"abiDecodingEnabled"`
	Thirdweb            ThirdwebConfig           `mapstructure:"thirdweb"`
}

type BadgerConfig

type BadgerConfig struct {
	Path string `mapstructure:"path"`
}

type BasicAuthConfig

type BasicAuthConfig struct {
	Username string `mapstructure:"username"`
	Password string `mapstructure:"password"`
}

type BlockPublisherConfig

type BlockPublisherConfig struct {
	Enabled   bool   `mapstructure:"enabled"`
	TopicName string `mapstructure:"topicName"`
}

type ClickhouseConfig

type ClickhouseConfig struct {
	Host                         string                         `mapstructure:"host"`
	Port                         int                            `mapstructure:"port"`
	Username                     string                         `mapstructure:"username"`
	Password                     string                         `mapstructure:"password"`
	Database                     string                         `mapstructure:"database"`
	DisableTLS                   bool                           `mapstructure:"disableTLS"`
	AsyncInsert                  bool                           `mapstructure:"asyncInsert"`
	MaxRowsPerInsert             int                            `mapstructure:"maxRowsPerInsert"`
	MaxOpenConns                 int                            `mapstructure:"maxOpenConns"`
	MaxIdleConns                 int                            `mapstructure:"maxIdleConns"`
	ChainBasedConfig             map[string]TableOverrideConfig `mapstructure:"chainBasedConfig"`
	EnableParallelViewProcessing bool                           `mapstructure:"enableParallelViewProcessing"`
	MaxQueryTime                 int                            `mapstructure:"maxQueryTime"`
	MaxMemoryUsage               int                            `mapstructure:"maxMemoryUsage"`
	EnableCompression            bool                           `mapstructure:"enableCompression"`
}

type CommitterConfig

type CommitterConfig struct {
	Enabled         bool `mapstructure:"enabled"`
	BlocksPerCommit int  `mapstructure:"blocksPerCommit"`
	FromBlock       int  `mapstructure:"fromBlock"`
	ToBlock         int  `mapstructure:"toBlock"`
}

type Config

type Config struct {
	RPC          RPCConfig          `mapstructure:"rpc"`
	Log          LogConfig          `mapstructure:"log"`
	Poller       PollerConfig       `mapstructure:"poller"`
	Committer    CommitterConfig    `mapstructure:"committer"`
	ReorgHandler ReorgHandlerConfig `mapstructure:"reorgHandler"`
	Storage      StorageConfig      `mapstructure:"storage"`
	API          APIConfig          `mapstructure:"api"`
	Publisher    PublisherConfig    `mapstructure:"publisher"`
	Validation   ValidationConfig   `mapstructure:"validation"`
	Migrator     MigratorConfig     `mapstructure:"migrator"`
}
var Cfg Config

type ContractApiRequestConfig

type ContractApiRequestConfig struct {
	MaxIdleConns        int  `mapstructure:"maxIdleConns"`
	MaxIdleConnsPerHost int  `mapstructure:"maxIdleConnsPerHost"`
	MaxConnsPerHost     int  `mapstructure:"maxConnsPerHost"`
	IdleConnTimeout     int  `mapstructure:"idleConnTimeout"`
	DisableCompression  bool `mapstructure:"disableCompression"`
	Timeout             int  `mapstructure:"timeout"`
}

type EventPublisherConfig

type EventPublisherConfig struct {
	Enabled       bool     `mapstructure:"enabled"`
	TopicName     string   `mapstructure:"topicName"`
	AddressFilter []string `mapstructure:"addressFilter"`
	Topic0Filter  []string `mapstructure:"topic0Filter"`
}

type KafkaConfig

type KafkaConfig struct {
	Brokers   string `mapstructure:"brokers"`
	Username  string `mapstructure:"username"`
	Password  string `mapstructure:"password"`
	EnableTLS bool   `mapstructure:"enableTLS"`
}

type LogConfig

type LogConfig struct {
	Level    string `mapstructure:"level"`
	Prettify bool   `mapstructure:"prettify"`
}

type MigratorConfig

type MigratorConfig struct {
	Destination StorageMainConfig `mapstructure:"destination"`
	StartBlock  uint              `mapstructure:"startBlock"`
	EndBlock    uint              `mapstructure:"endBlock"`
	BatchSize   uint              `mapstructure:"batchSize"`
	WorkerCount uint              `mapstructure:"workerCount"`
}

type ParquetConfig

type ParquetConfig struct {
	Compression  string `mapstructure:"compression"`
	RowGroupSize int64  `mapstructure:"rowGroupSize"`
	PageSize     int64  `mapstructure:"pageSize"`
}

type PebbleConfig

type PebbleConfig struct {
	Path string `mapstructure:"path"`
}

type PollerConfig

type PollerConfig struct {
	Enabled         bool            `mapstructure:"enabled"`
	ParallelPollers int             `mapstructure:"parallelPollers"`
	S3              *S3SourceConfig `mapstructure:"s3"`
}

type PostgresConfig

type PostgresConfig struct {
	Host            string `mapstructure:"host"`
	Port            int    `mapstructure:"port"`
	Username        string `mapstructure:"username"`
	Password        string `mapstructure:"password"`
	Database        string `mapstructure:"database"`
	SSLMode         string `mapstructure:"sslMode"`
	MaxOpenConns    int    `mapstructure:"maxOpenConns"`
	MaxIdleConns    int    `mapstructure:"maxIdleConns"`
	MaxConnLifetime int    `mapstructure:"maxConnLifetime"`
	ConnectTimeout  int    `mapstructure:"connectTimeout"`
}

type PublisherConfig

type PublisherConfig struct {
	Enabled      bool                       `mapstructure:"enabled"`
	Mode         string                     `mapstructure:"mode"`
	Brokers      string                     `mapstructure:"brokers"`
	Username     string                     `mapstructure:"username"`
	Password     string                     `mapstructure:"password"`
	EnableTLS    bool                       `mapstructure:"enableTLS"`
	Blocks       BlockPublisherConfig       `mapstructure:"blocks"`
	Transactions TransactionPublisherConfig `mapstructure:"transactions"`
	Traces       TracePublisherConfig       `mapstructure:"traces"`
	Events       EventPublisherConfig       `mapstructure:"events"`
}

type RPCBatchRequestConfig

type RPCBatchRequestConfig struct {
	BlocksPerRequest int `mapstructure:"blocksPerRequest"`
	BatchDelay       int `mapstructure:"batchDelay"`
}

type RPCConfig

type RPCConfig struct {
	URL           string                          `mapstructure:"url"`
	Blocks        RPCBatchRequestConfig           `mapstructure:"blocks"`
	Logs          RPCBatchRequestConfig           `mapstructure:"logs"`
	BlockReceipts ToggleableRPCBatchRequestConfig `mapstructure:"blockReceipts"`
	Traces        ToggleableRPCBatchRequestConfig `mapstructure:"traces"`
	ChainID       string                          `mapstructure:"chainId"`
}

type RedisConfig

type RedisConfig struct {
	Host      string `mapstructure:"host"`
	Port      int    `mapstructure:"port"`
	Password  string `mapstructure:"password"`
	DB        int    `mapstructure:"db"`
	EnableTLS bool   `mapstructure:"enableTLS"`
}

type ReorgHandlerConfig

type ReorgHandlerConfig struct {
	Enabled        bool `mapstructure:"enabled"`
	Interval       int  `mapstructure:"interval"`
	BlocksPerScan  int  `mapstructure:"blocksPerScan"`
	FromBlock      int  `mapstructure:"fromBlock"`
	ForceFromBlock bool `mapstructure:"forceFromBlock"`
}

type S3Config

type S3Config struct {
	Bucket          string `mapstructure:"bucket"`
	Region          string `mapstructure:"region"`
	Prefix          string `mapstructure:"prefix"`
	AccessKeyID     string `mapstructure:"accessKeyId"`
	SecretAccessKey string `mapstructure:"secretAccessKey"`
	Endpoint        string `mapstructure:"endpoint"`
}

type S3SourceConfig

type S3SourceConfig struct {
	S3Config               `mapstructure:",squash"`
	CacheDir               string        `mapstructure:"cacheDir"`
	MetadataTTL            time.Duration `mapstructure:"metadataTTL"`
	FileCacheTTL           time.Duration `mapstructure:"fileCacheTTL"`
	MaxCacheSize           int64         `mapstructure:"maxCacheSize"`
	CleanupInterval        time.Duration `mapstructure:"cleanupInterval"`
	MaxConcurrentDownloads int           `mapstructure:"maxConcurrentDownloads"`
}

type S3StorageConfig

type S3StorageConfig struct {
	S3Config `mapstructure:",squash"`
	Format   string         `mapstructure:"format"`
	Parquet  *ParquetConfig `mapstructure:"parquet"`
	// Buffering configuration
	BufferSize       int64 `mapstructure:"bufferSizeMB"`         // Target buffer size in MB before flush
	BufferTimeout    int   `mapstructure:"bufferTimeoutSeconds"` // Max time in seconds before flush
	MaxBlocksPerFile int   `mapstructure:"maxBlocksPerFile"`     // Max blocks per parquet file (0 = no limit, only size/timeout triggers)
}

type StorageConfig

type StorageConfig struct {
	Orchestrator StorageOrchestratorConfig `mapstructure:"orchestrator"`
	Staging      StorageStagingConfig      `mapstructure:"staging"`
	Main         StorageMainConfig         `mapstructure:"main"`
}

type StorageMainConfig

type StorageMainConfig struct {
	Type       string            `mapstructure:"type"`
	Clickhouse *ClickhouseConfig `mapstructure:"clickhouse"`
	Postgres   *PostgresConfig   `mapstructure:"postgres"`
	Kafka      *KafkaConfig      `mapstructure:"kafka"`
	S3         *S3StorageConfig  `mapstructure:"s3"`
}

type StorageOrchestratorConfig

type StorageOrchestratorConfig struct {
	Type       string            `mapstructure:"type"`
	Clickhouse *ClickhouseConfig `mapstructure:"clickhouse"`
	Postgres   *PostgresConfig   `mapstructure:"postgres"`
	Redis      *RedisConfig      `mapstructure:"redis"`
	Badger     *BadgerConfig     `mapstructure:"badger"`
	Pebble     *PebbleConfig     `mapstructure:"pebble"`
}

type StorageStagingConfig

type StorageStagingConfig struct {
	Type       string            `mapstructure:"type"`
	Clickhouse *ClickhouseConfig `mapstructure:"clickhouse"`
	Postgres   *PostgresConfig   `mapstructure:"postgres"`
	Badger     *BadgerConfig     `mapstructure:"badger"`
	Pebble     *PebbleConfig     `mapstructure:"pebble"`
}

type TableConfig

type TableConfig struct {
	DefaultSelectFields []string `mapstructure:"defaultSelectFields"`
	TableName           string   `mapstructure:"tableName"`
}

type TableOverrideConfig

type TableOverrideConfig map[string]TableConfig

type ThirdwebConfig

type ThirdwebConfig struct {
	ClientId string `mapstructure:"clientId"`
}

type ToggleableRPCBatchRequestConfig

type ToggleableRPCBatchRequestConfig struct {
	Enabled bool `mapstructure:"enabled"`
	RPCBatchRequestConfig
}

type TracePublisherConfig

type TracePublisherConfig struct {
	Enabled   bool   `mapstructure:"enabled"`
	TopicName string `mapstructure:"topicName"`
}

type TransactionPublisherConfig

type TransactionPublisherConfig struct {
	Enabled    bool     `mapstructure:"enabled"`
	TopicName  string   `mapstructure:"topicName"`
	ToFilter   []string `mapstructure:"toFilter"`
	FromFilter []string `mapstructure:"fromFilter"`
}

type ValidationConfig

type ValidationConfig struct {
	Mode string `mapstructure:"mode"` // "disabled", "minimal", "strict"
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL