config

package
v0.0.0-...-f1097ea Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2021 License: Unlicense Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache struct {
	Host     string `envconfig:"CACHE_HOST" default:"localhost"`
	Port     int    `envconfig:"CACHE_PORT" default:"6379"`
	Username string `envconfig:"CACHE_USERNAME" default:"default"`
	Password string `envconfig:"CACHE_PASSWORD" default:"oprosso"`
}

DataBase обеспечивает конфигурацию подключения к БД.

type Config

type Config struct {
	Cache    Cache
	DataBase DataBase
	Server   Server
	Logging  Logging
}

Config обеспечивает конфигурацию системы.

func Environ

func Environ() (*Config, error)

Environ возвращает настройки из окружения.

func (*Config) String

func (c *Config) String() string

String возвращает конфигурацию в строковом формате.

type DataBase

type DataBase struct {
	HostRo   string `envconfig:"DB_HOST_RO" default:"localhost"`
	PortRo   int    `envconfig:"DB_PORT_RO" default:"5432"`
	HostRw   string `envconfig:"DB_HOST_RW" default:"localhost"`
	PortRw   int    `envconfig:"DB_PORT_RW" default:"5432"`
	DBName   string `envconfig:"DB_NAME" default:"oprosso"`
	Username string `envconfig:"DB_USERNAME" default:"oprosso"`
	Password string `envconfig:"DB_PASSWORD" default:"new_password"`
}

DataBase обеспечивает конфигурацию подключения к БД.

type Logging

type Logging struct {
	Debug  bool `envconfig:"LOGS_DEBUG"`
	Trace  bool `envconfig:"LOGS_TRACE"`
	Color  bool `envconfig:"LOGS_COLOR"`
	Pretty bool `envconfig:"LOGS_PRETTY"`
	Text   bool `envconfig:"LOGS_TEXT"`
}

Logging предоставляет конфигурацию журналирования.

type Server

type Server struct {
	Host string `envconfig:"SERVER_HOST" default:"0.0.0.0"`
	Port string `envconfig:"PORT" default:"60001"`
}

Server предоставляет конфигурацию сервера.

Jump to

Keyboard shortcuts

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