config

package
v0.8.8 Latest Latest
Warning

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

Go to latest
Published: May 28, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AppName    = "oasishub-indexer"
	AppVersion = "0.8.8"
	GitCommit  = "-"
	GoVersion  = "1.14"
)

Variables

This section is empty.

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 added in v0.4.2

func VersionString() string

Types

type Config

type Config struct {
	AppEnv                       string `json:"app_env" envconfig:"APP_ENV" default:"development"`
	ProxyUrl                     string `json:"proxy_url" envconfig:"PROXY_URL"`
	ServerAddr                   string `json:"server_addr" envconfig:"SERVER_ADDR" default:"0.0.0.0"`
	ServerPort                   int64  `json:"server_port" envconfig:"SERVER_PORT" default:"8081"`
	FirstBlockHeight             int64  `json:"first_block_height" envconfig:"FIRST_BLOCK_HEIGHT" default:"1"`
	IndexWorkerInterval          string `json:"index_worker_interval" envconfig:"INDEX_WORKER_INTERVAL" default:"@every 15m"`
	SummarizeWorkerInterval      string `json:"summarize_worker_interval" envconfig:"SUMMARIZE_WORKER_INTERVAL" default:"@every 20m"`
	PurgeWorkerInterval          string `json:"purge_worker_interval" envconfig:"PURGE_WORKER_INTERVAL" default:"@every 1h"`
	DefaultBatchSize             int64  `json:"default_batch_size" envconfig:"DEFAULT_BATCH_SIZE" default:"0"`
	DatabaseDSN                  string `json:"database_dsn" envconfig:"DATABASE_DSN"`
	Debug                        bool   `json:"debug" envconfig:"DEBUG"`
	LogLevel                     string `json:"log_level" envconfig:"LOG_LEVEL" default:"info"`
	LogOutput                    string `json:"log_output" envconfig:"LOG_OUTPUT" default:"stdout"`
	RollbarAccessToken           string `json:"rollbar_access_token" envconfig:"ROLLBAR_ACCESS_TOKEN"`
	RollbarServerRoot            string `json:"rollbar_server_root" envconfig:"ROLLBAR_SERVER_ROOT"`
	IndexerMetricAddr            string `json:"indexer_metric_addr" envconfig:"INDEXER_METRIC_ADDR" default:":8080"`
	ServerMetricAddr             string `json:"server_metric_addr" envconfig:"SERVER_METRIC_ADDR" default:":8090"`
	MetricServerUrl              string `json:"metric_server_url" envconfig:"METRIC_SERVER_URL" default:"/metrics"`
	PurgeSequencesInterval       string `json:"purge_sequences_interval" envconfig:"PURGE_SEQUENCES_INTERVAL" default:"24h"`
	PurgeBalanceEventsInterval   string `json:"purge_balance_events_interval" envconfig:"PURGE_BALANCE_EVENTS_INTERVAL" default:"24h"`
	PurgeSystemEventsInterval    string `json:"purge_system_events_interval" envconfig:"PURGE_SYSTEM_EVENTS_INTERVAL" default:"24h"`
	PurgeHourlySummariesInterval string `json:"purge_hourly_summaries_interval" envconfig:"PURGE_HOURLY_SUMMARIES_INTERVAL" default:"24h"`
	IndexerConfigFile            string `json:"indexer_config_file" envconfig:"INDEXER_CONFIG_FILE" default:"indexer_config.json"`
}

Config holds the configuration data

func New

func New() *Config

New returns a new config

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) 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