config

package
v0.0.0-...-2d88f35 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// mainnet p2p config.
	MainNetP2ppNetworkID      = "/wormhole/mainnet/2"
	MainNetP2pBootstrap       = "" /* 341-byte string literal not displayed */
	MainNetP2pPort       uint = 8999

	// testnet p2p config.
	TestNetP2ppNetworkID      = "/wormhole/testnet/2/1"
	TestNetP2pBootstrap       = "" /* 223-byte string literal not displayed */
	TestNetP2pPort       uint = 8999

	// devnet p2p config.
	DevNetP2ppNetworkID      = "/wormhole/dev"
	DevNetP2pBootstrap       = "/dns4/guardian-0.guardian/udp/8999/quic/p2p/12D3KooWL3XJ9EMCyZvmmGXL2LMiVBtrVa2BuESsJiXkSj7333Jw"
	DevNetP2pPort       uint = 8999
)

p2p network configuration constants.

View Source
const (
	DbLayerMongo    = "mongo"
	DbLayerPostgres = "postgres"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AwsConfiguration

type AwsConfiguration struct {
	AwsRegion          string `env:"AWS_REGION,required"`
	AwsAccessKeyID     string `env:"AWS_ACCESS_KEY_ID"`
	AwsSecretAccessKey string `env:"AWS_SECRET_ACCESS_KEY"`
	AwsEndpoint        string `env:"AWS_ENDPOINT"`
	SqsUrl             string `env:"SQS_URL,required"`
	ObservationsSqsUrl string `env:"OBSERVATIONS_SQS_URL,required"`
	EventsSnsUrl       string `env:"EVENTS_SNS_URL,required"`
	VaaPipelineSnsUrl  string `env:"VAA_PIPELINE_SNS_URL,required"`
}

type Cache

type Cache struct {
	ExpirationInSeconds int64 `env:"CACHE_EXPIRATION_SECONDS,required"`
	NumKeys             int64 `env:"CACHE_NUM_KEYS,required"`
	MaxCostsInMB        int64 `env:"CACHE_MAX_COSTS_MB,required"`
}

type Configuration

type Configuration struct {
	P2pNetwork                string `env:"P2P_NETWORK,required"`
	Environment               string `env:"ENVIRONMENT,required"`
	LogLevel                  string `env:"LOG_LEVEL,default=warn"`
	MongoUri                  string `env:"MONGODB_URI,required"`
	MongoDatabase             string `env:"MONGODB_DATABASE,required"`
	MongoEnableQueryLog       bool   `env:"MONGODB_ENABLE_QUERY_LOG"`
	ObservationsChannelSize   int    `env:"OBSERVATIONS_CHANNEL_SIZE,required"`
	VaasChannelSize           int    `env:"VAAS_CHANNEL_SIZE,required"`
	HeartbeatsChannelSize     int    `env:"HEARTBEATS_CHANNEL_SIZE,required"`
	GovernorConfigChannelSize int    `env:"GOVERNOR_CONFIG_CHANNEL_SIZE,required"`
	GovernorStatusChannelSize int    `env:"GOVERNOR_STATUS_CHANNEL_SIZE,required"`
	VaasWorkersSize           int    `env:"VAAS_WORKERS_SIZE,default=5"`
	ObservationsWorkersSize   int    `env:"OBSERVATIONS_WORKERS_SIZE,default=10"`
	AlertEnabled              bool   `env:"ALERT_ENABLED"`
	AlertApiKey               string `env:"ALERT_API_KEY"`
	MetricsEnabled            bool   `env:"METRICS_ENABLED"`
	ApiPort                   uint   `env:"API_PORT,required"`
	P2pPort                   uint   `env:"P2P_PORT,required"`
	PprofEnabled              bool   `env:"PPROF_ENABLED"`
	MaxHealthTimeSeconds      int64  `env:"MAX_HEALTH_TIME_SECONDS,default=60"`
	IsLocal                   bool
	Redis                     *RedisConfiguration
	Aws                       *AwsConfiguration
	ObservationsDedup         Cache  `env:", prefix=OBSERVATIONS_DEDUP_,required"`
	ObservationsTxHash        Cache  `env:", prefix=OBSERVATIONS_TX_HASH_,required"`
	VaasDedup                 Cache  `env:", prefix=VAAS_DEDUP_,required"`
	VaasPythDedup             Cache  `env:", prefix=VAAS_PYTH_DEDUP_,required"`
	EthereumUrl               string `env:"ETHEREUM_URL,required"`
	DatabaseUrl               string `env:"DB_URL"`
	DatabaseLogEnabled        bool   `env:"DB_LOG_ENABLED"`
	DbLayer                   string `env:"DB_LAYER,default=mongo"` // mongo, postgres. Default is mongo.
}

func New

func New(ctx context.Context, isLocal *bool) (*Configuration, error)

New creates a configuration with the values from .env file and environment variables.

func (*Configuration) GetP2pNetwork

func (c *Configuration) GetP2pNetwork() (*P2pNetworkConfig, error)

GetP2pNetwork get p2p network config.

func (*Configuration) GetPrefix

func (c *Configuration) GetPrefix() string

type P2pNetworkConfig

type P2pNetworkConfig struct {
	Enviroment   string
	P2pNetworkID string
	P2pBootstrap string
}

P2pNetworkConfig config struct.

type RedisConfiguration

type RedisConfiguration struct {
	RedisUri        string `env:"REDIS_URI,required"`
	RedisPrefix     string `env:"REDIS_PREFIX,required"`
	RedisVaaChannel string `env:"REDIS_VAA_CHANNEL,required"`
}

Jump to

Keyboard shortcuts

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