config

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Development = "dev"
	Production  = "prod"
	Stage       = "stage"
)

Variables

This section is empty.

Functions

func InitConfig

func InitConfig(flagArgs *FlagArgs) error

Types

type ChainConfig

type ChainConfig struct {
	Name                       string            `yaml:"name"`
	ChainID                    *big.Int          `yaml:"chain_id"`
	BridgeContract             string            `yaml:"bridge_contract"`
	NodeUrl                    string            `yaml:"node_url"`
	PacketValidityWaitDuration time.Duration     `yaml:"pkt_validity_wait_dur"`
	FeedPacketWaitDuration     time.Duration     `yaml:"feed_pkt_wait_dur"`
	FinalityHeight             uint64            `yaml:"finality_height"`
	WalletPath                 string            `yaml:"wallet_path"`
	DestChains                 []string          `yaml:"dest_chains"`
	WalletAddress              string            `yaml:"wallet_address"`
	StartSeqNum                map[string]uint64 `yaml:"sequence_num_start"` // useful for aleo
	StartHeight                uint64            `yaml:"start_height"`       // useful for ethereum
	FilterTopic                string            `yaml:"filter_topic"`       // useful for ethereum
	RetryPacketWaitDur         time.Duration     `yaml:"retry_packet_wait_dur"`
	PruneBaseSeqNumberWaitDur  time.Duration     `yaml:"prune_base_seq_num_wait_dur"`
	AverageBlockGenDur         time.Duration     `yaml:"average_block_gen_dur"` // useful for aleo
}

type CollecterServiceConfig

type CollecterServiceConfig struct {
	Uri                 string        `yaml:"uri"`
	CollectorWaitDur    time.Duration `yaml:"collector_wait_dur"`
	CaCertificate       string        `yaml:"ca_certificate"`
	AttestorCertificate string        `yaml:"attestor_certificate"`
	AttestorKey         string        `yaml:"attestor_key"`
}

type Config

type Config struct {
	// ChainConfigs is set of configs of chains each required to communicate with its respective bridge contract
	Name                   string                 `yaml:"name"`
	ChainConfigs           []*ChainConfig         `yaml:"chains"`
	LogConfig              *LoggerConfig          `yaml:"log"`
	DBDir                  string                 `yaml:"db_dir"`
	DBPath                 string                 `yaml:"-"` // Calculate based on DBDir
	ConsumePacketWorker    int                    `yaml:"consume_packet_workers"`
	Mode                   string                 `yaml:"mode"`
	SigningServiceConfig   SigningServiceConfig   `yaml:"signing_service"`
	CollectorServiceConfig CollecterServiceConfig `yaml:"collector_service"`
	CheckHealthServiceDur  time.Duration          `yaml:"check_health_service"`
	MetricConfig           MetricsConfig          `yaml:"metrics"`
	Version                string                 `yaml:"version"`
}

func GetConfig

func GetConfig() *Config

type FlagArgs

type FlagArgs struct {
	ConfigFile string
	DBDir      string
	LogDir     string
	LogEnc     string
	Mode       string
	CleanStart bool
}

type LoggerConfig

type LoggerConfig struct {
	Encoding   string `yaml:"encoding"`
	OutputDir  string `yaml:"output_dir"`
	OutputPath string `yaml:"-"` // calculated based on OutputDir
}

type MetricsConfig

type MetricsConfig struct {
	Host    string `yaml:"host"`
	JobName string `yaml:"job_name"`
}

type SigningServiceConfig

type SigningServiceConfig struct {
	Host           string `yaml:"host"`
	Port           int    `yaml:"port"`
	Endpoint       string `yaml:"endpoint"`
	Scheme         string `yaml:"scheme"`
	Username       string `yaml:"username"`
	Password       string `yaml:"password"`
	HealthEndpoint string `yaml:"health_end_point"`
}

Jump to

Keyboard shortcuts

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