config

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	AppName    = "coda-indexer"
	AppVersion = "0.2.0"
	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"`
	CodaEndpoint     string `json:"coda_endpoint" envconfig:"CODA_ENDPOINT"`
	GenesisFile      string `json:"genesis_file" envconfig:"GENESIS_FILE"`
	ServerAddr       string `json:"server_addr" envconfig:"SERVER_ADDR" default:"0.0.0.0"`
	ServerPort       int    `json:"server_port" envconfig:"SERVER_PORT" default:"8081"`
	SyncInterval     string `json:"sync_interval" envconfig:"SYNC_INTERVAL" default:"10s"`
	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"`
	RollbarToken     string `json:"rollbar_token" envconfig:"ROLLBAR_TOKEN"`
	RollbarNamespace string `json:"rollbar_namespace" envconfig:"ROLLBAR_NAMESPACE"`
	// 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) 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