config

package
v0.0.0-...-c5fb9eb Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2021 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypePostgres         = "postgres"
	TypeTimescale        = "timescale"
	DefaultPostgresPort  = 5432
	DefaultTimescalePort = 5432
	DefaultMaxConn       = 5000
)

Variables

View Source
var ErrConfigRead = errors.New("failed to read/write config")
View Source
var POSTGRES string
View Source
var TIMESCALE string

Functions

func Merge

func Merge(prefix string, conf *Config)

Merge command line flags and environment variables with config.

Types

type Config

type Config struct {
	Port      int
	Postgres  Postgres
	Timescale Postgres
	Factory   FactoryConfig
	Pipe      PipeConfig
}

func Load

func Load(cfgFile string) (*Config, error)

func (*Config) Update

func (c *Config) Update(cfgFile string)

Update config on filesystem.

type FactoryConfig

type FactoryConfig struct {
	MaxLimit                   uint
	ErrorRate                  float64
	MaxTry, IDSize, CookieSize int
	BackupPath                 string
}

func DefaultFactory

func DefaultFactory() FactoryConfig

type PipeConfig

type PipeConfig struct {
	Streams   int
	BatchSize int
}

func DefaultPipe

func DefaultPipe() PipeConfig

type Postgres

type Postgres struct {
	DBType   string
	Username string
	Password string
	Host     string
	Database string
	Port     int
}

Postgres connection.

func DefaultPostgres

func DefaultPostgres() Postgres

func DefaultTimescale

func DefaultTimescale() Postgres

func (*Postgres) Connect

func (p *Postgres) Connect() *pgxpool.Pool

func (*Postgres) CreateTables

func (p *Postgres) CreateTables(pool *pgxpool.Pool, schema string)

Jump to

Keyboard shortcuts

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