config

package
v0.0.0-...-92d8de8 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFoundConfig = errors.New("NotFound Config")
)
View Source
var (
	YamlConfigPath = configFilePath("config.yml")
)

Functions

func IsFileExist

func IsFileExist(fPath string) bool

Types

type Config

type Config struct {
	Debug             bool        `json:"debug" yaml:"debug"`
	LowercaseKeywords bool        `json:"lowercaseKeywords" yaml:"lowercaseKeywords"`
	Connections       []*DBConfig `json:"connections" yaml:"connections"`
}

func GetConfig

func GetConfig(fp string) (*Config, error)

func GetDefaultConfig

func GetDefaultConfig() (*Config, error)

func NewConfig

func NewConfig() *Config

func (*Config) Load

func (c *Config) Load(fp string) error

func (*Config) Validate

func (c *Config) Validate() error

type DBConfig

type DBConfig struct {
	Alias          string                 `json:"alias" yaml:"alias"`
	Driver         dialect.DatabaseDriver `json:"driver" yaml:"driver"`
	DataSourceName string                 `json:"dataSourceName" yaml:"dataSourceName"`
	Proto          Proto                  `json:"proto" yaml:"proto"`
	User           string                 `json:"user" yaml:"user"`
	Passwd         string                 `json:"passwd" yaml:"passwd"`
	Host           string                 `json:"host" yaml:"host"`
	Port           int                    `json:"port" yaml:"port"`
	Path           string                 `json:"path" yaml:"path"`
	DBName         string                 `json:"dbName" yaml:"dbName"`
	Params         map[string]string      `json:"params" yaml:"params"`
	SSHCfg         *SSHConfig             `json:"sshConfig" yaml:"sshConfig"`
}

func (*DBConfig) Validate

func (c *DBConfig) Validate() error

type Proto

type Proto string
const (
	ProtoTCP  Proto = "tcp"
	ProtoUDP  Proto = "udp"
	ProtoUnix Proto = "unix"
)

type SSHConfig

type SSHConfig struct {
	Host       string `json:"host" yaml:"host"`
	Port       int    `json:"port" yaml:"port"`
	User       string `json:"user" yaml:"user"`
	PassPhrase string `json:"passPhrase" yaml:"passPhrase"`
	PrivateKey string `json:"privateKey" yaml:"privateKey"`
}

func (*SSHConfig) ClientConfig

func (s *SSHConfig) ClientConfig() (*ssh.ClientConfig, error)

func (*SSHConfig) Endpoint

func (s *SSHConfig) Endpoint() string

func (*SSHConfig) Validate

func (c *SSHConfig) Validate() error

Jump to

Keyboard shortcuts

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