config

package
v0.0.0-...-9b4e594 Latest Latest
Warning

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

Go to latest
Published: May 19, 2022 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 BrokerConfig

type BrokerConfig struct {
	Host     string `envconfig:"BROKER_URL" default:"localhost"`
	Port     string `envconfig:"BROKER_PORT" default:"5672"`
	User     string `envconfig:"BROKER_USER" default:"guest"`
	Password string `envconfig:"BROKER_PASSWORD" default:"guest"`
}

type FileServerConfig

type FileServerConfig struct {
	Server     string `envconfig:"FILE_SERVER_URL" default:"localhost:22"`
	User       string `envconfig:"FILE_SERVER_USER" default:"admin"`
	Password   string `envconfig:"FILE_SERVER_PASSWORD" default:"secret"`
	PrivateKey string `envconfig:"FILE_SERVER_PRIVATE_KEY"`

	KeyExchanges string `envconfig:"FILE_SERVER_KEY_EXCHANGES"`
}

type LoggerConfig

type LoggerConfig struct {
	ConsoleEnabled bool   `envconfig:"LOG_CONSOLE_ENABLED" default:"true"`
	ConsoleLevel   string `envconfig:"LOG_CONSOLE_LEVEL" default:"debug"`
	ConsoleJSON    bool   `envconfig:"LOG_CONSOLE_JSON" default:"false"`

	FileEnabled bool   `envconfig:"LOG_FILE_ENABLED" default:"false"`
	FileLevel   string `envconfig:"LOG_FILE_LEVEL" default:"info"`
	FileJSON    bool   `envconfig:"LOG_FILE_JSON" default:"true"`

	// Directory to log to to when filelogging is enabled
	Directory string `envconfig:"LOG_FILE_DIR" default:"./logs"`
	// Filename is the name of the logfile which will be placed inside the directory
	Filename string `envconfig:"LOG_FILE_NAME" default:"collector.log"`
	// MaxSize the max size in MB of the logfile before it's rolled
	MaxSize int `envconfig:"LOG_MAX_SIZE"`
	// MaxBackups the max number of rolled files to keep
	MaxBackups int `envconfig:"LOG_MAX_BACKUPS" default:"7"`
	// MaxAge the max age in days to keep a logfile
	MaxAge int `enconfig:"LOG_MAX_AGE" default:"1"`
}

type Settings

type Settings struct {
	ServiceName    string `envconfig:"SERVICE_NAME" default:"go-collector"`
	ServiceVersion string `envconfig:"SERVICE_VERSION" default:"0.0.0"`
	Env            string `envconfig:"ENVIRONMENT" default:"dev"`
	Debug          bool   `envconfig:"DEBUG" default:"false"`

	AwsRegion string `envconfig:"AWS_REGION" default:"sa-east-1"`

	TraceServiceName string `envconfig:"TRACE_SERVICE_NAME"`
	TraceURL         string `envconfig:"TRACE_URL" default:"http://localhost:14268"`
	TraceEnabled     bool   `envconfig:"TRACE_ENABLED" defult:"false"`

	BrokerConfig     BrokerConfig
	StorageConfig    StorageConfig
	FileServerConfig FileServerConfig
	LoggerConfig     LoggerConfig
}

func (*Settings) LoadFromEnv

func (s *Settings) LoadFromEnv() error

type StorageConfig

type StorageConfig struct {
	URL    string `envconfig:"STORAGE_HOST" default:"http://localhost.localstack.cloud:4566"`
	User   string `envconfig:"STORAGE_USER"`
	Key    string `envconfig:"STORAGE_KEY"`
	Bucket string `envconfig:"STORAGE_BUCKET" default:"collector-files"`
}

Jump to

Keyboard shortcuts

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