config

package
v0.0.22 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

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.

type Duration added in v0.0.18

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.18

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

UnmarshalText implements yaml unmarshaler.

type EventAPI added in v0.0.10

type EventAPI struct {
	Enabled bool   `yaml:"enabled"`
	Host    string `yaml:"host"`
	Port    int    `yaml:"port"`
}

EventAPI contains configuration details for application event API.

func (*EventAPI) Address added in v0.0.10

func (api *EventAPI) Address() string

Address returns calculated address for connecting to NATS.

type Kratos added in v0.0.21

type Kratos struct {
	BaseURL string `yaml:"base_url"`
}

type Log added in v0.0.18

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

Log represents settings for application logger.

type Server added in v0.0.18

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"`
	EventAPI EventAPI `yaml:"event_api"`
	Log      Log      `yaml:"log"`
	Server   Server   `yaml:"server"`
	Kratos   Kratos   `yaml:"kratos"`
}

Settings is decoded configuration file.

func New

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

New reads application configuration from specified file path.

Jump to

Keyboard shortcuts

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