config

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	IsEnableDebugLogs            bool   `envconfig:"ENABLE_DEBUG_LOGS" default:"false"`
	IsReadCurrencyDataFromFile   bool   `envconfig:"READ_CURRENCIES_FROM_FILE" default:"false"`
	CurrencySourceUrl            string `envconfig:"CURRENCIES_SOURCE_URL" default:"https://www.cbr.ru/scripts/XML_daily.asp"`
	CurrencySourceFile           string `envconfig:"CURRENCIES_SOURCE_FILE" default:"currencies.xml"`
	HttpRequestProtocol          string `envconfig:"HTTP_REQUEST_PROTOCOL" default:"HTTP/2"`
	FakeUserAgentHeaderValue     string `envconfig:"FAKE_USER_AGENT_HEADER_VALUE" default:"Mozilla/5.0 (X11; Linux x86_64)"`
	IsUseMultithreadedParsing    bool   `envconfig:"USE_MULTITHREADED_PARSING" default:"true"`
	TimeWhenNeedToUpdateCurrency string `envconfig:"TIME_WHEN_NEED_TO_UPDATE_CURRENCY" default:"13:30:00"`

	DbDriver   string `envconfig:"DB_DRIVER" default:"postgres"`
	DbHostname string `envconfig:"DB_HOSTNAME" default:"localhost"`
	DbPort     string `envconfig:"DB_PORT" default:"5432"`
	DbUsername string `envconfig:"DB_USERNAME" default:"postgres"`
	DbPassword string `envconfig:"DB_PASSWORD" default:""`
	DbDatabase string `envconfig:"DB_DATABASE" default:"currency_storage"`
	DbSSLMode  string `envconfig:"DB_SSLMODE" default:"disable"`

	HttpServerListenIp   string `envconfig:"HTTP_SERVER_LISTEN_IP" default:"0.0.0.0"`
	HttpServerListenPort string `envconfig:"HTTP_SERVER_LISTEN_PORT" default:"8080"`
}

func New

func New() *Config

New Config constructor.

func (*Config) Init

func (c *Config) Init() error

Init initialization from environment variables

Jump to

Keyboard shortcuts

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