config

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2025 License: MIT Imports: 5 Imported by: 3 modules, 3 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadConfig

func LoadConfig(filename string) (*viper.Viper, error)

Load config file from given path

Types

type AWS

type AWS struct {
	Endpoint      string
	AccessKey     string
	SecretKey     string
	UseSSL        bool
	MinioEndpoint string `yaml:"minio-endpoint,omitempty"`
}

AWS S3

type Config

type Config struct {
	App        map[interface{}]interface{} `yaml:"app"`
	Env        string                      `yaml:"env"`
	Version    string                      `yaml:"version"`
	HTTPServer HTTPServerConfig            `yaml:"http-server,omitempty" mapstructure:"http-server"`

	Logger  Logger  `yaml:"logger"`
	Jaeger  Jaeger  `yaml:"jaeger"`
	Metrics Metrics `yaml:"metrics"`
	Docs    Docs

	KafkaConsumer KafkaConsumer `yaml:"kafkaConsumer"`
	KafkaProducer KafkaProducer `yaml:"kafkaConsumer"`

	RabbitMQ RabbitMQConfig `yaml:"rabbitmq,omitempty"`
	Postgres PostgresConfig `yaml:"postgres,omitempty"`
	Redis    RedisConfig    `yaml:"redis,omitempty"`
	MongoDB  MongoDB        `yaml:"mongodb,omitempty"`
	AWS      AWS            `yaml:"aws,omitempty"`

	Cookie  Cookie  `yaml:"cookie,omitempty"`
	Session Session `yaml:"session,omitempty"`

	NotificationSmtp Smtp `yaml:"NotificationSmtp,omitempty"`
}

App config struct

func ParseConfig

func ParseConfig(v *viper.Viper) (*Config, error)

Parse config file

type Cookie struct {
	Name     string
	MaxAge   int
	Secure   bool
	HTTPOnly bool
}

Cookie config

type Docs added in v1.1.0

type Docs struct {
	Enable bool
	Title  string
	Prefix string
}

Swagger configuration

type HTTPServerConfig

type HTTPServerConfig struct {
	Port              string
	PprofPort         string
	JwtSecretKey      string
	CookieName        string
	ReadTimeout       time.Duration
	WriteTimeout      time.Duration
	SSL               bool
	CtxDefaultTimeout time.Duration
	CSRF              bool
	Debug             bool
}

HTTP Server config struct

type Jaeger

type Jaeger struct {
	Host        string
	ServiceName string
	LogSpans    bool
}

Jaeger config

type KafkaConsumer added in v1.2.0

type KafkaConsumer struct {
	Brokers string   `yaml:"brokers"`
	GroupID string   `yaml:"groupID"`
	Topics  []string `yaml:"topics"`
}

type KafkaProducer added in v1.2.0

type KafkaProducer struct {
	Brokers string   `yaml:"brokers"`
	Topics  []string `yaml:"topics"`
}

type Logger

type Logger struct {
	Development       bool
	DisableCaller     bool
	DisableStacktrace bool
	Encoding          string
	Level             string
}

Logger config

type Metrics

type Metrics struct {
	URL         string
	ServiceName string
}

Metrics config

type MongoDB

type MongoDB struct {
	MongoURI string
}

MongoDB config

type PostgresConfig

type PostgresConfig struct {
	PostgresqlHost     string
	PostgresqlPort     string
	PostgresqlUser     string
	PostgresqlPassword string
	PostgresqlDbname   string
	PostgresqlSSLMode  bool
	PgDriver           string
}

Postgresql config

type RabbitMQConfig added in v1.1.0

type RabbitMQConfig struct {
	Host     string
	Port     string
	User     string
	Password string
	Exchange string
	Queue    string
}

type RedisConfig

type RedisConfig struct {
	RedisAddr     string `yaml:"Host"`
	RedisPassword string `yaml:"RedisPassword"`
	MaxRetries    int    `yaml:"MaxRetries"`
	User          string `yaml:"User"`
	DB            int    `yaml:"DbId"`
	DialTimeout   int    `yaml:"DialTimeout"` // таймаут для установки новых соединений
	Timeout       int    `yaml:"Timeout"`     // таймаут для чтения и записи
}

Redis config

type Session

type Session struct {
	Prefix string
	Name   string
	Expire int
}

Session config

type Smtp added in v1.4.0

type Smtp struct {
	Host     string
	Port     string
	From     string
	User     string
	NickName string
	Password string
}

Jump to

Keyboard shortcuts

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