config

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2024 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FlagConfigPath          = "config-path"
	FlagConfigType          = "config-type"
	FlagConfigAwsRegion     = "aws-region"
	FlagConfigAwsSecretKey  = "aws-secret-key"
	FlagConfigPrivateKey    = "private-key"
	FlagConfigBlsPrivateKey = "bls-private-key"
	FlagConfigDbPass        = "db-pass"
	FlagConfigDbUsername    = "db-username"

	DBDialectMysql   = "mysql"
	DBDialectSqlite3 = "sqlite3"

	LocalConfig            = "local"
	AWSConfig              = "aws"
	KeyTypeLocalPrivateKey = "local_private_key"
	KeyTypeAWSPrivateKey   = "aws_private_key"

	ConfigType       = "CONFIG_TYPE"
	ConfigFilePath   = "CONFIG_FILE_PATH"
	ConfigDBPass     = "DB_PASSWORD"
	ConfigDBUserName = "DB_USERNAME"
)

Variables

This section is empty.

Functions

func GetSecret

func GetSecret(secretName, region string) (string, error)

func SendTelegramMessage

func SendTelegramMessage(identity string, botId string, chatId string, msg string)

Types

type AdminConfig

type AdminConfig struct {
	Port uint16 `json:"port"`
}

func (*AdminConfig) Validate

func (cfg *AdminConfig) Validate()

type AlertConfig

type AlertConfig struct {
	Identity       string `json:"identity"`
	TelegramBotId  string `json:"telegram_bot_id"`
	TelegramChatId string `json:"telegram_chat_id"`
}

type BSCConfig

type BSCConfig struct {
	OpBNB                     bool     `json:"op_bnb"`
	KeyType                   string   `json:"key_type"`
	AWSRegion                 string   `json:"aws_region"`
	AWSSecretName             string   `json:"aws_secret_name"`
	RPCAddrs                  []string `json:"rpc_addrs"`
	PrivateKey                string   `json:"private_key"`
	GasLimit                  uint64   `json:"gas_limit"`
	GasPrice                  uint64   `json:"gas_price"`
	NumberOfBlocksForFinality uint64   `json:"number_of_blocks_for_finality"`
	StartHeight               uint64   `json:"start_height"`
	ChainId                   uint64   `json:"chain_id"`
}

func (*BSCConfig) IsOpCrossChain

func (cfg *BSCConfig) IsOpCrossChain() bool

func (*BSCConfig) Validate

func (cfg *BSCConfig) Validate()

type Config

type Config struct {
	GreenfieldConfig GreenfieldConfig `json:"greenfield_config"`
	BSCConfig        BSCConfig        `json:"bsc_config"`
	RelayConfig      RelayConfig      `json:"relay_config"`
	VotePoolConfig   VotePoolConfig   `json:"vote_pool_config"`
	LogConfig        LogConfig        `json:"log_config"`
	AdminConfig      AdminConfig      `json:"admin_config"`
	AlertConfig      AlertConfig      `json:"alert_config"`
	DBConfig         DBConfig         `json:"db_config"`
}

func ParseConfigFromFile

func ParseConfigFromFile(filePath string) *Config

func ParseConfigFromJson

func ParseConfigFromJson(content string) *Config

func (*Config) Validate

func (cfg *Config) Validate()

type DBConfig

type DBConfig struct {
	Dialect       string `json:"dialect"`
	KeyType       string `json:"key_type"`
	AWSRegion     string `json:"aws_region"`
	AWSSecretName string `json:"aws_secret_name"`
	Password      string `json:"password"`
	Username      string `json:"username"`
	Url           string `json:"url"`
	MaxIdleConns  int    `json:"max_idle_conns"`
	MaxOpenConns  int    `json:"max_open_conns"`
}

func (*DBConfig) Validate

func (cfg *DBConfig) Validate()

type GreenfieldConfig

type GreenfieldConfig struct {
	KeyType            string   `json:"key_type"`
	AWSRegion          string   `json:"aws_region"`
	AWSSecretName      string   `json:"aws_secret_name"`
	AWSBlsSecretName   string   `json:"aws_bls_secret_name"`
	RPCAddrs           []string `json:"rpc_addrs"`
	PrivateKey         string   `json:"private_key"`
	BlsPrivateKey      string   `json:"bls_private_key"`
	ChainId            uint64   `json:"chain_id"`
	StartHeight        uint64   `json:"start_height"`
	MonitorChannelList []uint8  `json:"monitor_channel_list"`
	GasLimit           int64    `json:"gas_limit"`
	FeeAmount          int64    `json:"fee_amount"`
	ChainIdString      string   `json:"chain_id_string"`
	UseWebsocket       bool     `json:"use_websocket"`
}

func (*GreenfieldConfig) Validate

func (cfg *GreenfieldConfig) Validate()

type LogConfig

type LogConfig struct {
	Level                        string `json:"level"`
	Filename                     string `json:"filename"`
	MaxFileSizeInMB              int    `json:"max_file_size_in_mb"`
	MaxBackupsOfLogFiles         int    `json:"max_backups_of_log_files"`
	MaxAgeToRetainLogFilesInDays int    `json:"max_age_to_retain_log_files_in_days"`
	UseConsoleLogger             bool   `json:"use_console_logger"`
	UseFileLogger                bool   `json:"use_file_logger"`
	Compress                     bool   `json:"compress"`
}

func (*LogConfig) Validate

func (cfg *LogConfig) Validate()

type RelayConfig

type RelayConfig struct {
	BSCToGreenfieldInturnRelayerTimeout int64  `json:"bsc_to_greenfield_inturn_relayer_timeout"` // in second
	GreenfieldToBSCInturnRelayerTimeout int64  `json:"greenfield_to_bsc_inturn_relayer_timeout"` // in second
	GreenfieldSequenceUpdateLatency     int64  `json:"greenfield_sequence_update_latency"`       // in second
	BSCSequenceUpdateLatency            int64  `json:"bsc_sequence_update_latency"`              // in second
	CrossChainContractAddr              string `json:"cross_chain_contract_addr"`
	GreenfieldLightClientContractAddr   string `json:"greenfield_light_client_contract_addr"`
	RelayerHubContractAddr              string `json:"relayer_hub_contract_addr"`
	SrcZkmeSBTContractAddr              string `json:"src_zkmesbt_contract_addr"`
}

func (*RelayConfig) Validate

func (cfg *RelayConfig) Validate()

type VotePoolConfig

type VotePoolConfig struct {
	BroadcastIntervalInMillisecond int64 `json:"broadcast_interval_in_millisecond"`
	VotesBatchMaxSizePerInterval   int64 `json:"votes_batch_max_size_per_interval"`
	QueryIntervalInMillisecond     int64 `json:"query_interval_in_millisecond"`
}

func (*VotePoolConfig) Validate

func (cfg *VotePoolConfig) Validate()

Jump to

Keyboard shortcuts

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