config

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: May 15, 2025 License: Apache-2.0 Imports: 3 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Environment string `json:"environment"`
	*Database
	*Redis
	*Meilisearch
	*Elasticsearch
	*MongoDB
	*Neo4j
	*RabbitMQ
	*Kafka
}

Config data config struct

func GetConfig

func GetConfig(v *viper.Viper) *Config

GetConfig returns data config

type DBNode

type DBNode struct {
	Driver          string        `json:"driver"`
	Source          string        `json:"source"`
	Logging         bool          `json:"logging"`
	MaxIdleConn     int           `json:"max_idle_conn"`
	MaxOpenConn     int           `json:"max_open_conn"`
	ConnMaxLifeTime time.Duration `json:"conn_max_life_time"`
	Weight          int           `json:"weight"`
}

DBNode represents a single database node configuration

type Database

type Database struct {
	Master   *DBNode   `json:"master"`
	Slaves   []*DBNode `json:"slaves"`
	Migrate  bool      `json:"migrate"`
	Strategy string    `json:"strategy"`
	MaxRetry int       `json:"max_retry"`
}

Database database config struct

type Elasticsearch

type Elasticsearch struct {
	Addresses []string `json:"addresses"`
	Username  string   `json:"username"`
	Password  string   `json:"password"`
}

Elasticsearch elasticsearch config struct

type Kafka

type Kafka struct {
	Brokers        []string
	ClientID       string
	ConsumerGroup  string
	Topic          string
	ReadTimeout    time.Duration
	WriteTimeout   time.Duration
	ConnectTimeout time.Duration
}

Kafka kafka config struct

type Meilisearch

type Meilisearch struct {
	Host   string `json:"host"`
	APIKey string `json:"api_key"`
}

Meilisearch meilisearch config struct

type MongoDB

type MongoDB struct {
	Master   *MongoNode   `json:"master"`
	Slaves   []*MongoNode `json:"slaves"`
	Strategy string       `json:"strategy"`
	MaxRetry int          `json:"max_retry"`
}

MongoDB mongodb config struct

type MongoNode

type MongoNode struct {
	URI     string `json:"uri"`
	Logging bool   `json:"logging"`
	Weight  int    `json:"weight"`
}

MongoNode mongodb node config

type Neo4j

type Neo4j struct {
	URI      string
	Username string
	Password string
}

Neo4j neo4j config struct

type RabbitMQ

type RabbitMQ struct {
	URL               string
	Username          string
	Password          string
	Vhost             string
	ConnectionTimeout time.Duration
	HeartbeatInterval time.Duration
}

RabbitMQ rabbitmq config struct

type Redis

type Redis struct {
	Addr         string
	Username     string
	Password     string
	Db           int
	ReadTimeout  time.Duration
	WriteTimeout time.Duration
	DialTimeout  time.Duration
}

Redis redis config struct

Jump to

Keyboard shortcuts

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