config

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Version int          `yaml:"version"`
	Global  GlobalConfig `yaml:"global"`
	Sources []Source     `yaml:"sources"`
	Rules   []Rule       `yaml:"rules"`
	Sinks   []Sink       `yaml:"sinks"`
}

Config holds the YAML configuration.

func Load

func Load(path string) (*Config, error)

Load reads, interpolates env vars, parses YAML, and validates.

func (*Config) Validate

func (c *Config) Validate() error

Validate performs small, direct schema checks.

type Dedupe

type Dedupe struct {
	Key string `yaml:"key"`
	TTL string `yaml:"ttl"`
}

type GlobalConfig

type GlobalConfig struct {
	DBPath        string            `yaml:"db_path"`
	Confirmations map[string]uint64 `yaml:"confirmations"`
}

type MatchSpec

type MatchSpec struct {
	Type     string   `yaml:"type"`
	Contract string   `yaml:"contract"`
	Event    string   `yaml:"event"`
	AppID    uint64   `yaml:"app_id"`
	Where    []string `yaml:"where"`
}

type RateLimit

type RateLimit struct {
	Capacity float64 `yaml:"capacity"` // max tokens
	Rate     float64 `yaml:"rate"`     // tokens per second
}

type Rule

type Rule struct {
	ID        string     `yaml:"id"`
	Source    string     `yaml:"source"`
	Match     MatchSpec  `yaml:"match"`
	Sinks     []string   `yaml:"sinks"`
	Dedupe    *Dedupe    `yaml:"dedupe,omitempty"`
	RateLimit *RateLimit `yaml:"rate_limit,omitempty"`
}

func (*Rule) Validate

func (r *Rule) Validate(sourceIDs map[string]struct{}, sinkIDs map[string]*Sink) error

type Sink

type Sink struct {
	ID         string `yaml:"id"`
	Type       string `yaml:"type"`
	WebhookURL string `yaml:"webhook_url"`
	Template   string `yaml:"template"`
	URL        string `yaml:"url"`
	Method     string `yaml:"method"`
}

func (*Sink) Validate

func (s *Sink) Validate() error

type Source

type Source struct {
	ID         string   `yaml:"id"`
	Type       string   `yaml:"type"`
	RPCURL     string   `yaml:"rpc_url"`
	StartBlock string   `yaml:"start_block"`
	ABIDirs    []string `yaml:"abi_dirs"`

	AlgodURL   string `yaml:"algod_url"`
	IndexerURL string `yaml:"indexer_url"`
	StartRound string `yaml:"start_round"`
}

func (*Source) Validate

func (s *Source) Validate() error

Jump to

Keyboard shortcuts

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