config

package
v0.0.0-...-a2ea4c1 Latest Latest
Warning

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

Go to latest
Published: May 13, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientCfg

type ClientCfg struct {
	Host      string `env:"CLIENT_HOST" env-default:"localhost"`
	Port      string `env:"CLIENT_PORT" env-default:"8080"`
	Path      string `env:"CHAT_PATH" env-default:"/chat"`
	Scheme    string `env:"CLIENT_SCHEME" env-default:"ws"`
	LoggerLVL string `env:"CLIENT_LOGGER_LEVEL" env-default:"info"`
}

func NewClientCfg

func NewClientCfg() (ClientCfg, error)

type KafkaCfg

type KafkaCfg struct {
	Topic     string `env:"KAFKA_TOPIC" env-default:"chat"`
	Partition int    `env:"KAFKA_PARTITION" env-default:"0"`
	Addr      string `env:"KAFKA_ADDR" env-default:"localhost:9092"`
	GroupID   string `env:"KAFKA_GROUP_ID" env-default:"chat"`
	BatchSize int    `env:"KAFKA_BATCH_SIZE" env-default:"10"`
	Async     bool   `env:"KAFKA_ASYNC" env-default:"true"`
}

type RedisAddr

type RedisAddr struct {
	Host       string `env:"REDIS_HOST" env-default:"localhost"`
	Port       string `env:"REDIS_PORT" env-default:"6379"`
	MaxRecords int64  `env:"REDIS_MAX_RECORDS" env-default:"1000"`
	HeadSize   int64  `env:"REDIS_HEAD_SIZE" env-default:"10"`
}

type RepoCfg

type RepoCfg struct {
	Schema        string `env:"DB_SCHEMA" env-default:"postgres"`
	Host          string `env:"DB_HOST" env-default:"localhost"`
	Port          string `env:"DB_PORT" env-default:"5432"`
	Name          string `env:"DB_NAME" env-default:"postgres"`
	User          string `env:"DB_USER" env-default:"postgres"`
	Password      string `env:"DB_PASSWORD" env-required:"true"`
	MigrationPath string `env:"DB_MIGRATION_PATH" env-default:"./migrations"`
}

type ServerAddr

type ServerAddr struct {
	Host string `env:"SRV_HOST" env-default:"localhost"`
	Port string `env:"SRV_PORT" env-default:"8080"`
}

type ServerCfg

type ServerCfg struct {
	Server    ServerAddr
	Storage   StorageAddr
	Redis     RedisAddr
	Kafka     KafkaCfg
	LoggerLVL string `env:"SERVER_LOGGER_LEVEL" env-default:"info"`
}

func NewServerCfg

func NewServerCfg() (ServerCfg, error)

type StorageAddr

type StorageAddr struct {
	Host string `env:"STORAGE_HOST" env-default:"localhost"`
	Port string `env:"STORAGE_PORT" env-default:"8000"`
}

type StorageConfig

type StorageConfig struct {
	HTTP      StorageAddr
	Repo      RepoCfg
	Kafka     KafkaCfg
	LoggerLVL string `env:"STORAGE_LOGGER_LEVEL" env-default:"info"`
}

func NewStorageCfg

func NewStorageCfg() (StorageConfig, error)

Jump to

Keyboard shortcuts

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