config

package
v0.0.32 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultInsertBatchSize = 1000

Variables

This section is empty.

Functions

This section is empty.

Types

type Database

type Database struct {
	Host     string `yaml:"host"`
	Port     int    `yaml:"port"`
	User     string `yaml:"username"`
	Password string `yaml:"password"`
	Name     string `yaml:"database"`
	SSLMode  string `yaml:"ssl_mode"`
}

Database contains configuration details for database.

func (*Database) Address

func (db *Database) Address() string

Address return API address in "host:port" format.

type Duration added in v0.0.16

type Duration struct {
	time.Duration
}

Duration represents custom type for unmarshaling string. For example: "500ms", "1s", "2m", etc.

func (*Duration) UnmarshalText added in v0.0.16

func (d *Duration) UnmarshalText(text []byte) error

UnmarshalText implements yaml unmarshaler.

type Log added in v0.0.16

type Log struct {
	Level string `yaml:"level"`
	Mode  string `yaml:"mode"`
}

Log represents settings for application logger.

type NATS added in v0.0.31

type NATS struct {
	Host     string `yaml:"host"`
	Port     int    `yaml:"port"`
	User     string `yaml:"user"`
	Password string `yaml:"password"`
}

NATS contains configuration details for application event API.

func (*NATS) Address added in v0.0.31

func (nats *NATS) Address() string

Address returns calculated address for connecting to NATS.

type Server added in v0.0.16

type Server struct {
	ShutdownTimeout Duration `yaml:"shutdown_timeout"`
	ReadTimeout     Duration `yaml:"read_timeout"`
	WriteTimeout    Duration `yaml:"write_timeout"`
	IdleTimeout     Duration `yaml:"idle_timeout"`
}

Server represents settings for creating http server.

type Settings

type Settings struct {
	DB     Database `yaml:"database"`
	Worker Worker   `yaml:"worker"`
	Log    Log      `yaml:"log"`
	Server Server   `yaml:"server"`
	NATS   NATS     `yaml:"nats"`
}

Settings is decoded configuration file.

func New

func New(path string) (*Settings, error)

New reads application configuration from specified file path.

type Worker

type Worker struct {
	PackageID       string `yaml:"package_id"`
	InsertBatchSize int    `yaml:"insert_batch_size"`
}

Worker contains settings for data processing by cmd/worker.

Jump to

Keyboard shortcuts

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