config

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package consumer implements the NSQ worker logic.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AWSS3Cfg

type AWSS3Cfg struct {
	Region    string `mapstructure:"region"`
	SecretKey string `mapstructure:"secret_key"`
	AccessKey string `mapstructure:"access_key"`
}

AWSS3Cfg represents AWS S3 credentials.

type BrokerCfg

type BrokerCfg struct {
	// the data source name (DSN) for connecting to the broker server.
	Address string `mapstructure:"address"`
	// Topic name to write to.
	Topic string `mapstructure:"topic"`
}

BrokerCfg represents Kafka producer config.

type Config

type Config struct {
	// The IP:Port. Defaults to 8080.
	Address string `mapstructure:"address"`
	// Debug mode.
	Debug bool `mapstructure:"debug"`
	// Log level. Defaults to info.
	LogLevel string `mapstructure:"log_level"`
	// The data source name (DSN) for th frontend.
	FrontendAddress string `mapstructure:"frontend_address"`
	// JWT signing key.
	JWTSigningKey string `mapstructure:"jwt_signkey"`
	// JWT expiration in hours.
	JWTExpiration int `mapstructure:"jwt_expiration"`
	// Maximum file size to allow for samples.
	MaxFileSize int64 `mapstructure:"max_file_size"`
	// Maximum avatar size to allow for user profile picture.
	MaxAvatarSize int64 `mapstructure:"max_avatar_file_size"`
	// Database configuration.
	DB DatabaseCfg `mapstructure:"db"`
	// Broker server configuration.
	Broker BrokerCfg `mapstructure:"nsq"`
	// Frontend Configuration.
	UI UICfg `mapstructure:"ui"`
	// Object storage configuration.
	ObjStorage StorageCfg `mapstructure:"storage"`
	// SMTP server configuration.
	SMTP SMTPConfig `mapstructure:"smtp"`
}

Config represents our application config.

func Load

func Load(path string) (*Config, error)

Load returns an application configuration which is populated from the given configuration file.

type DatabaseCfg

type DatabaseCfg struct {
	// the data source name (DSN) for connecting to the database.
	Server string `mapstructure:"server"`
	// Username used to access the db.
	Username string `mapstructure:"username"`
	// Password used to access the db.
	Password string `mapstructure:"password"`
	// Name of the couchbase bucket.
	BucketName string `mapstructure:"bucket_name"`
}

DatabaseCfg represents the database config.

type LocalFsCfg

type LocalFsCfg struct {
	RootDir string `mapstructure:"root_dir"`
}

LocalFsCfg represents local file system storage data.

type MinioCfg

type MinioCfg struct {
	Endpoint  string `mapstructure:"endpoint"`
	SecretKey string `mapstructure:"secret_key"`
	AccessKey string `mapstructure:"access_key"`
	Region    string `mapstructure:"region"`
}

MinioCfg represents Minio credentials.

type SMTPConfig

type SMTPConfig struct {
	Server   string `mapstructure:"server"`
	Port     int    `mapstructure:"port"`
	User     string `mapstructure:"user"`
	Password string `mapstructure:"password"`
}

type StorageCfg

type StorageCfg struct {
	// Deployment kind, possible values: aws, gcp, azure, local.
	DeploymentKind string `mapstructure:"deployment_kind"`
	// FileContainerName represents the name of the container for samples.
	FileContainerName string `mapstructure:"files_container_name"`
	// AvatarsContainerName represents the name of the container for avatars.
	AvatarsContainerName string `mapstructure:"avatars_container_name"`
	// S3 represents AWS S3 object storage connection details.
	S3 AWSS3Cfg `mapstructure:"s3"`
	// S3 represents MinIO object storage connection details.
	Minio MinioCfg `mapstructure:"minio"`
	// Local represents local file system config.
	Local LocalFsCfg `mapstructure:"local"`
}

StorageCfg represents the object storage config.

type UICfg

type UICfg struct {
	// the data source name (DSN) for connecting to the frontend.
	Address string `mapstructure:"address"`
}

UICfg represents frontend config.

Jump to

Keyboard shortcuts

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