config

package
v0.0.0-...-f979f54 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Settings

type Settings struct {
	Log struct {
		Type  string `yaml:"type"  validate:"one_of=human,json"`
		Level string `yaml:"level" validate:"one_of=debug,info,warning,error"`
	} `yaml:"log"`

	Databases []struct {
		Enabled               bool   `yaml:"enabled"`
		Verbose               bool   `yaml:"verbose"`
		DumpAll               bool   `yaml:"dumpAll"`
		DumpServer            bool   `yaml:"dumpServer"`
		Version               int    `yaml:"version"  validate:"one_of=10,11,12,13,14"`
		Port                  int    `yaml:"port" validate:"ne=0"`
		Host                  string `yaml:"host" validate:"empty=false"`
		Name                  string `yaml:"name" validate:"empty=false"`
		Database              string `yaml:"database"`
		Username              string `yaml:"username" validate:"empty=false"`
		Password              string `yaml:"password" validate:"empty=false"`
		ExcludeDatabases      string `yaml:"excludeDatabases"`
		ExcludeDatabasesSlice []string
	} `yaml:"databases"`

	Outputs struct {
		TmpDir string `yaml:"tmpDir" validate:"empty=false"`
		Minio  struct {
			Enabled         bool   `yaml:"enabled"`
			Endpoint        string `yaml:"endpoint"`
			AccessKeyID     string `yaml:"accessKeyID"`
			BucketName      string `yaml:"bucketName"`
			SecretAccessKey string `yaml:"secretAccessKey"`
		} `yaml:"minio"`
		Sftp struct {
			Enabled   bool   `yaml:"enabled"`
			Port      int    `yaml:"port"`
			Host      string `yaml:"host"`
			User      string `yaml:"user"`
			Password  string `yaml:"password"`
			Directory string `yaml:"directory"`
		} `yaml:"sftp"`
		Filesystem struct {
			Enabled bool   `yaml:"enabled"`
			Path    string `yaml:"path"`
		} `yaml:"filesystem"`
	} `yaml:"outputs"`

	Notifiers struct {
		Email struct {
			Enabled       bool   `yaml:"enabled"`
			SendOnSuccess bool   `yaml:"sendOnSuccess"`
			Port          int    `yaml:"port"`
			SMTP          string `yaml:"smtp"`
			Sender        string `yaml:"sender"`
			Password      string `yaml:"password"`
		} `yaml:"email"`
		Slack struct {
			Verbose       bool   `yaml:"verbose"`
			Enabled       bool   `yaml:"enabled"`
			SendOnSuccess bool   `yaml:"sendOnSuccess"`
			BotToken      string `yaml:"botToken" validate:"empty=false"`
			Channel       string `yaml:"channel"  validate:"empty=false"`
		} `yaml:"slack"`
	} `yaml:"notifiers"`
}

func New

func New(filePath string) (Settings, error)

New returns validated Settings instance. Errors on file opening or configuration miss sense.

Jump to

Keyboard shortcuts

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