config

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApplicationConfig

type ApplicationConfig struct {
	Env    Environment `default:"dev"`
	Logger LoggerConfig
	Queue  QueueConfig
	Web    Web
}

func ReadConfig

func ReadConfig() (*ApplicationConfig, error)

ReadConfig reads configuration from the environment and populates the structure with it

type Environment added in v1.2.0

type Environment string

Environment defines the application environment to adjust settings to it.

const (
	Dev  Environment = "dev"
	Prod Environment = "prod"
)

type LoggerConfig added in v1.2.0

type LoggerConfig struct {
	Level LoggerLevel `default:"info"` //Level of minimum logging
}

LoggerConfig represents configuration of the logger

type LoggerLevel added in v1.2.0

type LoggerLevel string

LoggerLevel defines the minimum logging level to process

const (
	TraceLevel LoggerLevel = "trace"
	DebugLevel LoggerLevel = "debug"
	InfoLevel  LoggerLevel = "info"
	WarnLevel  LoggerLevel = "warn"
	ErrorLevel LoggerLevel = "error"
	PanicLevel LoggerLevel = "panic"
)

func (LoggerLevel) ToZapLevel added in v1.2.0

func (ll LoggerLevel) ToZapLevel() zapcore.Level

type QueueConfig

type QueueConfig struct {
	//UrlRequestQueue name to listen to the new events
	UrlRequestQueue string `default:"data-scraping-asd" envconfig:"URL_REQUEST_QUEUE"`
	//ScrapingResultQueue represents a queue name to send processed ApiSpecDoc
	ScrapingResultQueue string `default:"storage-update-asd" envconfig:"SCRAPING_RESULT_QUEUE"`
	//NotificationQueue represents a queue name to notify a user about an error or success (if required)
	NotificationQueue string `default:"gateway-scrape-notifications" envconfig:"NOTIFICATION_QUEUE"`
	//Url is a RabbitMQ url
	Url string `default:"amqp://guest:guest@localhost:5672/"`
	//Concurrency represents number of parallel handlers
	Concurrency int `default:"30"`
}

QueueConfig queue configuration

type Web added in v1.4.0

type Web struct {
	//RespLimBytes represents the maximum file size (in bytes) to download.
	RespLimBytes int64 `default:"5242880"`
}

Web is a web-related properties configuration

Jump to

Keyboard shortcuts

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