config

package
v0.19.4 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	AppName    = "mina-indexer"
	AppVersion = "0.19.4"
	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 InitRollbar

func InitRollbar(cfg *Config)

InitRollbar configures the rollbar tracker

func TrackError

func TrackError(err error)

TrackError records an error

func TrackPanic

func TrackPanic(err interface{})

TrackPanic records the panic error to rollbar

func TrackRecovery

func TrackRecovery()

TrackRecovery logs all panics to rollbar

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"`
	MinaEndpoint          string `json:"mina_endpoint" envconfig:"MINA_ENDPOINT"`
	ArchiveEndpoint       string `json:"archive_endpoint" envconfig:"ARCHIVE_ENDPOINT"`
	GenesisFile           string `json:"genesis_file" envconfig:"GENESIS_FILE"`
	StaketabEndpoint      string `json:"staketab_endpoint" envconfig:"STAKETAB_ENDPOINT" default:"https://api.staketab.com/mina"`
	IdentityFile          string `json:"identity_file" envconfig:"IDENTITY_FILE"`
	ServerAddr            string `json:"server_addr" envconfig:"SERVER_ADDR" default:"0.0.0.0"`
	ServerPort            int    `json:"server_port" envconfig:"SERVER_PORT" default:"8080"`
	SyncInterval          string `json:"sync_interval" envconfig:"SYNC_INTERVAL" default:"60s"`
	CleanupInterval       string `json:"cleanup_interval" envconfig:"CLEANUP_INTERVAL" default:"10m"`
	CleanupThreshold      int    `json:"cleanup_threshold" envconfig:"CLEANUP_THRESHOLD" default:"1000"`
	DatabaseURL           string `json:"database_url" envconfig:"DATABASE_URL"`
	DumpDir               string `json:"dump_dir" envconfig:"DUMP_DIR"`
	LogLevel              string `json:"log_level" envconfig:"LOG_LEVEL" default:"info"`
	LogFormat             string `json:"log_format" envconfig:"LOG_FORMAT" default:"text"`
	RollbarToken          string `json:"rollbar_token" envconfig:"ROLLBAR_TOKEN"`
	RollbarNamespace      string `json:"rollbar_namespace" envconfig:"ROLLBAR_NAMESPACE"`
	HistoricalLimit       uint   `json:"historical_limit" envconfig:"HISTORICAL_LIMIT" default:"290"`
	StagingLedgerDisabled bool   `json:"staging_ledger_disabled" envconfig:"STAGING_LEDGER_DISABLED"`
	// contains filtered or unexported fields
}

Config holds the configuration 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) 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

Jump to

Keyboard shortcuts

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