config

package
v0.0.30 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2021 License: MIT Imports: 4 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 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"`
}

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