config

package
v0.18.14 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	AppName    = "near-indexer"
	AppVersion = "0.18.7"
	GitCommit  = "-"
	GoVersion  = "-"
)

Functions

func FromEnv

func FromEnv(config *Config) error

FromEnv reads the config from environment variables

func FromFile

func FromFile(path string, config *Config) error

FromFile reads the config from a file

func VersionString

func VersionString() string

VersionString returns the full app version string

Types

type Config

type Config struct {
	AppEnv                  string `json:"app_env" envconfig:"APP_ENV" default:"development"`
	Network                 string `json:"network_id" envconfig:"NETWORK_ID" default:"near"`
	ChainID                 string `json:"chain_id" envconfig:"CHAIN_ID" default:"mainnet"`
	RPCEndpoints            string `json:"rpc_endpoints" envconfig:"NEAR_RPC_ENDPOINTS" default:"http://0.0.0.0:3030"`
	RPCApiKey               string `json:"rpc_api_key" envconfig:"NEAR_RPC_API_KEY" default:""`
	RPCTimeout              string `json:"rpc_timeout" envconfig:"NEAR_RPC_TIMEOUT" default:"75s"`
	ServerAddr              string `json:"server_addr" envconfig:"SERVER_ADDR" default:"0.0.0.0"`
	ServerPort              int    `json:"server_port" envconfig:"SERVER_PORT" default:"8081"`
	StartHeight             uint64 `json:"start_height" envconfig:"START_HEIGHT"`
	SyncInterval            string `json:"sync_interval" envconfig:"SYNC_INTERVAL" default:"500ms"`
	SyncBatchSize           int    `json:"sync_batch_size" envconfig:"SYNC_BATCH_SIZE" default:"10"`
	CleanupInterval         string `json:"cleanup_interval" envconfig:"CLEANUP_INTERVAL" default:"10m"`
	CleanupThreshold        int    `json:"cleanup_threshold" envconfig:"CLEANUP_THRESHOLD" default:"3600"`
	DatabaseURL             string `json:"database_url" envconfig:"DATABASE_URL"`
	DumpDir                 string `json:"dump_dir" envconfig:"DUMP_DIR"`
	Debug                   bool   `json:"debug" envconfig:"DEBUG"`
	LogLevel                string `json:"log_level" envconfig:"LOG_LEVEL" default:"info"`
	DatastoreGRPCAddr       string `json:"datastore_grpc_addr" envconfig:"DATASTORE_GRPC_ADDR" default:""`
	DatastoreGRPCMsgSize    int    `json:"datastore_grpc_msg_size" envconfig:"DATASTORE_GRPC_MSG_SIZE" default:"104857600"` // 100*1024*1024
	RewardsHTTPStoreAddress string `json:"rewards_http_store_address" envconfig:"REWARDS_HTTP_STORE_ADDRESS" default:""`

	// delegation calls
	RetryCountDlg    int `json:"retry_count_delegation_calls" envconfig:"RETRY_COUNT_DELEGATION_CALLS" default:"4"`
	ConcurrencyLevel int `json:"concurrency_level" envconfig:"CONCURRENCY_LEVEL" default:"2"`

	// MetricsServer
	IndexerMetricAddr string `json:"indexer_metric_addr" envconfig:"INDEXER_METRIC_ADDR" default:"0.0.0.0:8080"`
	// contains filtered or unexported fields
}

Config holds the configration data

func New

func New() *Config

New returns a new config

func (*Config) CleanupDuration

func (c *Config) CleanupDuration() time.Duration

CleanupDuration returns the parsed duration for the cleanup pipeline

func (*Config) IsDevelopment

func (c *Config) IsDevelopment() bool

IsDevelopment returns true if app is in dev mode

func (*Config) IsProduction

func (c *Config) IsProduction() bool

IsProduction returns true if app is in production mode

func (*Config) ListenAddr

func (c *Config) ListenAddr() string

ListenAddr returns a full listen address and port

func (*Config) RPCClientTimeout added in v0.3.0

func (c *Config) RPCClientTimeout() time.Duration

RPCClientTimeout returns the timeout value for RPC calls

func (*Config) SyncDuration

func (c *Config) SyncDuration() time.Duration

SyncDuration returns the parsed duration for the sync pipeline

func (*Config) Validate

func (c *Config) Validate() error

Validate returns an error if config is invalid

type OutputSplitter added in v0.18.0

type OutputSplitter struct{}

func (*OutputSplitter) Write added in v0.18.0

func (splitter *OutputSplitter) Write(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

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