config

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2020 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CurrentVer string = "v1.0.2"
	CurrentDSN string = "https://72dd7f93900d4742a436a525692a13ed@sentry.io/2124482"
)

software version, sentry bug tracking id

Variables

This section is empty.

Functions

func CheckConfig

func CheckConfig(servConf ServConfig) int

CheckConfig : detect uri validity, check needed config for recaptcha, check max expire, check cryptography requirement

func FileExist

func FileExist(filepath string) bool

FileExist : check if file exists, utils

Types

type Content

type Content struct {
	DetectAbuse bool `yaml:"detect_abuse"`
	ExpireHrs   int  `yaml:"expire_hrs"`
}

Content : subconfig about content abusing detection

type Network

type Network struct {
	Listen     string `yaml:"listen"`
	Host       string `yaml:"host"`
	MongodbURL string `yaml:"mongodb_url"`
}

Network : subconfig of ServConf

type Recaptcha

type Recaptcha struct {
	Enable    bool   `yaml:"enable"`
	SecretKey string `yaml:"secret_key,omitempty"`
	SiteKey   string `yaml:"site_key,omitempty"`
}

Recaptcha : subconfig of ServConf

type Security

type Security struct {
	MasterKey       string `yaml:"master_key"`
	EncryptionKey   string `yaml:"encryption_key"`
	EncryptionNonce string `yaml:"encryption_nonce"`
}

Security : subconfig about data encryption and administration must fulfill chacha20 standard

type ServConfig

type ServConfig struct {
	Network   Network   `yaml:"network"`
	Recaptcha Recaptcha `yaml:"recaptcha"`
	Security  Security  `yaml:"security"`
	Content   Content   `yaml:"content"`
}

ServConfig consists of 4 parts

var (
	ServConf ServConfig
)

global var for global server config read

func LoadConfig

func LoadConfig(filePath string) (ServConfig, error)

LoadConfig : config load function, read from file.

Jump to

Keyboard shortcuts

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