config

package
v0.0.0-...-19dc864 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2025 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	Name    string `mapstructure:"NAME"`
	MODE    string `mapstructure:"MODE"`
	Version string `mapstructure:"VERSION"`
}

App -.

type Config

type Config struct {
	App       App       `mapstructure:"APP"`
	HTTP      HTTP      `mapstructure:"HTTP"`
	Log       Log       `mapstructure:"LOG"`
	PG        PG        `mapstructure:"PG"`
	Redis     Redis     `mapstructure:"REDIS"`
	GRPC      GRPC      `mapstructure:"GRPC"`
	RMQ       RMQ       `mapstructure:"RMQ"`
	Kafka     Kafka     `mapstructure:"KAFKA"`
	NATS      NATS      `mapstructure:"NATS"`
	Metrics   Metrics   `mapstructure:"METRICS"`
	Profiling Profiling `mapstructure:"PROFILING"`
	Swagger   Swagger   `mapstructure:"SWAGGER"`
	JWT       JWT       `mapstructure:"JWT"`
}

Config -.

func NewConfig

func NewConfig() (*Config, error)

NewConfig returns app config.

func (*Config) Validate

func (c *Config) Validate() error

type Control

type Control struct {
	ProducerEnabled bool `mapstructure:"PRODUCER_ENABLED"`
	ConsumerEnabled bool `mapstructure:"CONSUMER_ENABLED"`
}

Control -.

type GRPC

type GRPC struct {
	Port string `mapstructure:"PORT"`
}

GRPC -.

type HTTP

type HTTP struct {
	Port            string        `mapstructure:"PORT"`
	ReadTimeout     time.Duration `mapstructure:"READ_TIMEOUT"`
	WriteTimeout    time.Duration `mapstructure:"WRITE_TIMEOUT"`
	IdleTimeout     time.Duration `mapstructure:"IDLE_TIMEOUT"`
	ShutdownTimeout time.Duration `mapstructure:"SHUTDOWN_TIMEOUT"`
	UsePreforkMode  bool          `mapstructure:"USE_PREFORK_MODE"`
	ApiTimeout      time.Duration `mapstructure:"API_TIMEOUT"`
}

HTTP -.

type InOutRequest

type InOutRequest struct {
	PrintRequest  bool `mapstructure:"PRINT_REQUEST"`
	PrintResponse bool `mapstructure:"PRINT_RESPONSE"`
}

IN/Out Request

type JWT

type JWT struct {
	Secret string `mapstructure:"SECRET"`
}

JWTConfig -.

type Kafka

type Kafka struct {
	Brokers []string `mapstructure:"BROKERS"`
	GroupID string   `mapstructure:"GROUP_ID"`
	Topics  Topics   `mapstructure:"TOPICS"`
	Control Control  `mapstructure:"CONTROL"`
}

Kafka -.

type Log

type Log struct {
	Level             string       `mapstructure:"LEVEL"`
	InCommingRequest  InOutRequest `mapstructure:"IN_COMMING_REQUEST"`
	OutCommingRequest InOutRequest `mapstructure:"OUT_COMMING_REQUEST"`
}

Log -.

type Metrics

type Metrics struct {
	Enabled bool `mapstructure:"ENABLED"`
	// SetSkipPaths type array string,
	// Declare string, handle split sep ";"
	SetSkipPaths string `mapstructure:"SKIP_PATHS"`
	// Path metrics, default /metrics
	Path string `mapstructure:"PATH"`
}

Metrics -.

type NATS

type NATS struct {
	URL     string        `mapstructure:"URL"`
	Timeout time.Duration `mapstructure:"TIMEOUT"`
	Enable  bool          `mapstructure:"ENABLE"`
}

NATS -.

type PG

type PG struct {
	PoolMax           int           `mapstructure:"POOL_MAX"`
	PoolMin           int           `mapstructure:"POOL_MIN"`
	MaxConnLifetime   time.Duration `mapstructure:"MAX_CONN_LIFETIME"`
	MaxConnIdleTime   time.Duration `mapstructure:"MAX_CONN_IDLE_TIME"`
	HealthCheckPeriod time.Duration `mapstructure:"HEALTH_CHECK_PERIOD"`
	URL               string        `mapstructure:"URL"`
}

PG -.

type Profiling

type Profiling struct {
	Enabled bool `mapstructure:"ENABLED"`
	// Path for profiling endpoints, default /debug
	Path string `mapstructure:"PATH"`
	// CPU profiling duration in seconds
	CPUProfileDuration int `mapstructure:"CPU_PROFILE_DURATION"`
	// Memory profiling interval in seconds
	MemoryProfileInterval int `mapstructure:"MEMORY_PROFILE_INTERVAL"`
}

Profiling -.

type RMQ

type RMQ struct {
	ServerExchange string `mapstructure:"RPC_SERVER"`
	ClientExchange string `mapstructure:"RPC_CLIENT"`
	URL            string `mapstructure:"URL"`
}

RMQ -.

type Redis

type Redis struct {
	URL string `mapstructure:"URL"`
}

Redis -.

type Swagger

type Swagger struct {
	Enabled bool `mapstructure:"ENABLED"`
}

Swagger -.

type Topics

type Topics struct {
	UserEvents        string `mapstructure:"USER_EVENTS"`
	TranslationEvents string `mapstructure:"TRANSLATION_EVENTS"`
}

Topics -.

Jump to

Keyboard shortcuts

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