config

package
v0.1.11 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 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 {
	*Database      `yaml:"database" json:"database"`
	*Redis         `yaml:"redis" json:"redis"`
	*Meilisearch   `yaml:"meilisearch" json:"meilisearch"`
	*Elasticsearch `yaml:"elasticsearch" json:"elasticsearch"`
	*OpenSearch    `yaml:"opensearch" json:"opensearch"`
	*MongoDB       `yaml:"mongodb" json:"mongodb"`
	*Neo4j         `yaml:"neo4j" json:"neo4j"`
	*RabbitMQ      `yaml:"rabbitmq" json:"rabbitmq"`
	*Kafka         `yaml:"kafka" json:"kafka"`
	*Metrics       `yaml:"metrics" json:"metrics"`
}

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" yaml:"driver"`
	Source          string        `json:"source" yaml:"source"`
	Logging         bool          `json:"logging" yaml:"logging"`
	MaxIdleConn     int           `json:"max_idle_conn" yaml:"max_idle_conn"`
	MaxOpenConn     int           `json:"max_open_conn" yaml:"max_open_conn"`
	ConnMaxLifeTime time.Duration `json:"conn_max_life_time" yaml:"conn_max_life_time"`
	Weight          int           `json:"weight" yaml:"weight"`
}

DBNode represents a single database node configuration

type Database

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

Database database config struct

type Elasticsearch

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

Elasticsearch elasticsearch config struct

type Kafka

type Kafka struct {
	Brokers        []string      `json:"brokers" yaml:"brokers"`
	ClientID       string        `json:"client_id" yaml:"client_id"`
	ConsumerGroup  string        `json:"consumer_group" yaml:"consumer_group"`
	Topic          string        `json:"topic" yaml:"topic"`
	ReadTimeout    time.Duration `json:"read_timeout" yaml:"read_timeout"`
	WriteTimeout   time.Duration `json:"write_timeout" yaml:"write_timeout"`
	ConnectTimeout time.Duration `json:"connect_timeout" yaml:"connect_timeout"`
}

Kafka kafka config struct

type Meilisearch

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

Meilisearch meilisearch config struct

type Metrics added in v0.1.5

type Metrics struct {
	Enabled       bool   `yaml:"enabled" json:"enabled"`
	StorageType   string `yaml:"storage_type" json:"storage_type"` // "memory", "redis"
	KeyPrefix     string `yaml:"key_prefix" json:"key_prefix"`
	RetentionDays int    `yaml:"retention_days" json:"retention_days"`
	BatchSize     int    `yaml:"batch_size" json:"batch_size"`
}

Metrics data metrics config

type MongoDB

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

MongoDB mongodb config struct

type MongoNode

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

MongoNode mongodb node config

type Neo4j

type Neo4j struct {
	URI      string `json:"uri" yaml:"uri"`
	Username string `json:"username" yaml:"username"`
	Password string `json:"password" yaml:"password"`
}

Neo4j neo4j config struct

type OpenSearch added in v0.1.4

type OpenSearch struct {
	Addresses       []string `json:"addresses" yaml:"addresses"`
	Username        string   `json:"username" yaml:"username"`
	Password        string   `json:"password" yaml:"password"`
	InsecureSkipTLS bool     `json:"insecure_skip_tls" yaml:"insecure_skip_tls"`
}

OpenSearch opensearch config struct

type RabbitMQ

type RabbitMQ struct {
	URL               string        `json:"url" yaml:"url"`
	Username          string        `json:"username" yaml:"username"`
	Password          string        `json:"password" yaml:"password"`
	Vhost             string        `json:"vhost" yaml:"vhost"`
	ConnectionTimeout time.Duration `json:"connection_timeout" yaml:"connection_timeout"`
	HeartbeatInterval time.Duration `json:"heartbeat_interval" yaml:"heartbeat_interval"`
}

RabbitMQ rabbitmq config struct

type Redis

type Redis struct {
	Addr         string        `json:"addr" yaml:"addr"`
	Username     string        `json:"username" yaml:"username"`
	Password     string        `json:"password" yaml:"password"`
	Db           int           `json:"db" yaml:"db"`
	ReadTimeout  time.Duration `json:"read_timeout" yaml:"read_timeout"`
	WriteTimeout time.Duration `json:"write_timeout" yaml:"write_timeout"`
	DialTimeout  time.Duration `json:"dial_timeout" yaml:"dial_timeout"`
}

Redis redis config struct

Jump to

Keyboard shortcuts

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