Help us shape the future of Go! Take the 2026 Go Developer Survey

config

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2021 License: Apache-2.0 Imports: 5 Imported by: 7

Documentation

Index

Constants

View Source
const (
	// CAFile is the certificate authority file
	CAFile = "ca.pem"
	// CertFile is the certificate file
	CertFile = "rmd-cert.pem"
	// KeyFile is the rmd private key file
	KeyFile = "rmd-key.pem"
	// ClientCAFile certificate authority file of client side
	ClientCAFile = "ca.pem"
)

Variables

View Source
var ClientAuth = map[string]tls.ClientAuthType{
	"no":              tls.NoClientCert,
	"require":         tls.RequestClientCert,
	"require_any":     tls.RequireAnyClientCert,
	"challenge_given": tls.VerifyClientCertIfGiven,
	"challenge":       tls.RequireAndVerifyClientCert,
}

ClientAuth is a string to tls clientAuthType map

Functions

func Init

func Init() error

Init does config initial

Types

type Config

type Config struct {
	Def Default  `mapstructure:"default"`
	Db  Database `mapstructure:"database"`
	Dbg Debug    `mapstructure:"debug"`
}

Config represent the configuration struct

func NewConfig

func NewConfig() Config

NewConfig loads configurations from config file and pflag

type Database

type Database struct {
	Backend   string `toml:"backend"`
	Transport string `toml:"transport"`
	DBName    string `toml:"dbname"`
}

Database represents data base configuration

type Debug

type Debug struct {
	Enabled   bool `toml:"enabled"`
	Debugport uint `toml:"debugport"`
}

Debug configurations

type Default

type Default struct {
	Address             string `toml:"address"`
	TLSPort             uint   `toml:"tlsport"`
	CertPath            string `toml:"certpath"`
	ClientCAPath        string `toml:"clientcapath"`
	ClientAuth          string `toml:"clientauth"`
	UnixSock            string `toml:"unixsock"`
	PolicyPath          string `toml:"policypath"`
	OpenStackEnable     bool   `toml:"openstackenable"`
	SysResctrl          string `toml:"sysresctrl"`
	Plugins             string `toml:"plugins"`
	DbValidatorInterval uint   `toml:"dbValidatorInterval"`
}

Default is the configuration in default section of config file TODO consider create a new struct for TLSConfig

Jump to

Keyboard shortcuts

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