config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2021 License: Apache-2.0, MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromEnv

func FromEnv(config *Config) error

FromEnv reads the configuration from environment variables

func FromFile

func FromFile(path string, config *Config) error

FromFile reads the configuration from a file

Types

type Config

type Config struct {
	RPCEndpoint   string `json:"rpc_endpoint" envconfig:"RPC_ENDPOINT"`
	DatabaseDSN   string `json:"database_dsn" envconfig:"DATABASE_DSN"`
	ServerAddr    string `json:"server_addr" envconfig:"SERVER_ADDR" default:"0.0.0.0"`
	ServerPort    uint16 `json:"server_port" envconfig:"SERVER_PORT" default:"8080"`
	InitialHeight int64  `json:"initial_height" envconfig:"INITIAL_HEIGHT"`
	BatchSize     int64  `json:"batch_size" envconfig:"BATCH_SIZE"`
	Debug         bool   `json:"debug" envconfig:"DEBUG"`
}

Config holds the configuration data

func New

func New() *Config

New creates a new configuration

func (*Config) ListenAddr

func (c *Config) ListenAddr() string

ListenAddr returns a listen address

func (*Config) Validate

func (c *Config) Validate() error

Validate checks if the configuration is valid

Jump to

Keyboard shortcuts

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