config

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2024 License: MIT Imports: 11 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Logger      LoggerConfig       `json:"logger" yaml:"logger"`
	Host        string             `json:"host" yaml:"host"`
	Username    string             `json:"username" yaml:"username"`
	Password    string             `json:"password" yaml:"password"`
	Database    string             `json:"database" yaml:"database"`
	Publication publication.Config `json:"publication" yaml:"publication"`
	Slot        slot.Config        `json:"slot" yaml:"slot"`
	Metric      MetricConfig       `json:"metric" yaml:"metric"`
	DebugMode   bool               `json:"debugMode" yaml:"debugMode"`
}

func ReadConfigJSON

func ReadConfigJSON(path string) (Config, error)

func ReadConfigYAML

func ReadConfigYAML(path string) (Config, error)

func (Config) DSN

func (c Config) DSN() string

func (*Config) DSNWithoutSSL

func (c *Config) DSNWithoutSSL() string

func (*Config) Print

func (c *Config) Print()

func (*Config) SetDefault

func (c *Config) SetDefault()

func (*Config) Validate

func (c *Config) Validate() error

type LoggerConfig

type LoggerConfig struct {
	Logger   logger.Logger `json:"-" yaml:"-"`         // custom logger
	LogLevel slog.Level    `json:"level" yaml:"level"` // if custom logger is nil, set the slog log level
}

type MetricConfig

type MetricConfig struct {
	Port int `json:"port" yaml:"port"`
}

Jump to

Keyboard shortcuts

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