config

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ObfuscateCrendentials

func ObfuscateCrendentials(mongoConnectionString string) string

Considering the following structure for MongoDB connection string: "mongodb://<username>:<password>@<host>:<port>" The following function will replaces the username and password with "****"

Types

type AppConfig

type AppConfig struct {
	// Application logging configuration
	Logging struct {
		Level string `yaml:"level"`
	} `yaml:"logging"`

	// The replication configuration
	Repl ReplConfig `yaml:"repl"`
}
var Current *AppConfig = NewConfig()

func NewConfig

func NewConfig() *AppConfig

NewConfig returns a new Config struct

func (*AppConfig) LoadConfig

func (c *AppConfig) LoadConfig() error

LoadConfig loads the configuration from a file

func (*AppConfig) LogConfig

func (c *AppConfig) LogConfig()

type FullReplConfig

type FullReplConfig struct {
	// The batch size for replication
	BatchSize int `yaml:"batch"`
	// Update on duplicate key
	UpdateOnDuplicate bool `yaml:"update_on_duplicate"`
}

type IncrReplConfig

type IncrReplConfig struct {
	// The state of the replication
	State struct {
		Database   string `yaml:"db"`
		Collection string `yaml:"collection"`
	} `yaml:"state"`
}

type ReplConfig

type ReplConfig struct {

	// The replication id
	Id string `yaml:"id"`
	// The address of the MongoDB server
	Source string `json:"Source" yaml:"source"`
	// The address of the MongoDB server
	Target string `json:"Target" yaml:"target"`

	// The list of databases to replicate
	Databases   []string        `yaml:"databases"`
	DatabasesIn map[string]bool `yaml:"-"`

	// Collection whitelist/blacklist
	Filters    map[string][]string `yaml:"filters"`
	FiltersIn  map[string]bool     `yaml:"-"`
	FiltersOut map[string]bool     `yaml:"-"`

	// The replication configuration
	Full FullReplConfig `yaml:"full"`
	Incr IncrReplConfig `yaml:"incr"`
}

Jump to

Keyboard shortcuts

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