conf

package
v0.0.0-...-823f4d2 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Load

func Load(fp string, verbose bool) error

Load loads the given fp (file path) to the C global configuration variable.

Types

type Conf

type Conf struct {
	NameServer string `yaml:"name_server" form:"name_server"`
	Host       string `yaml:"host" form:"host"`
	Port       int    `yaml:"port" form:"port"`
	AppendPort bool   `yaml:"append_port" form:"append_port"`

	Token string `yaml:"token" form:"token"`

	ServeHTTPS bool   `yaml:"serve_https" form:"serve_https"`
	SSLCert    string `yaml:"ssl_cert" form:"ssl_cert"`
	SSLPrivKey string `yaml:"ssl_private_key" form:"ssl_private_key"`

	UploadDir    string  `yaml:"upload_dir" form:"upload_dir"`
	DB           string  `yaml:"db" form:"db"`
	UniURILength int     `yaml:"uniuri_length" form:"uniuri_length"`
	KeyLength    int     `yaml:"key_length" form:"key_length"`
	SizeLimit    int64   `yaml:"size_limit" form:"size_limit"`
	ViewLimit    int64   `yaml:"view_limit" form:"view_limit"`
	DiskQuota    float64 `yaml:"disk_quota" form:"disk_quota"`
	LogLevel     string  `yaml:"loglevel" form:"loglevel"`

	Stats             bool `yaml:"stats" form:"stats"`
	SensitiveMode     bool `yaml:"sensitive_mode" form:"sensitive_mode"`
	NoWeb             bool `yaml:"no_web" form:"no_web"`
	FullDoc           bool `yaml:"fulldoc" form:"fulldoc"`
	AlwaysDownload    bool `yaml:"always_download" form:"always_download"`
	DisableEncryption bool `yaml:"disable_encryption" form:"disable_encryption"`
	PrometheusEnabled bool `yaml:"prometheus_enabled" form:"prometheus_enabled"`
}

Conf is the struct containing the configuration of the server

var C Conf

C is the exported global configuration variable

func NewDefault

func NewDefault() Conf

NewDefault returns a Conf instance filled with default values

func (*Conf) FillDefaults

func (c *Conf) FillDefaults() error

FillDefaults fills the zero value fields in the UnparsedConf with default values

func (*Conf) Validate

func (c *Conf) Validate() map[string]string

Validate validates that an unparsed configuration is valid.

type UnparsedConf

type UnparsedConf struct {
	NameServer string `yaml:"name_server" form:"name_server"`
	Host       string `yaml:"host" form:"host"`
	Port       int    `yaml:"port" form:"port"`
	AppendPort bool   `yaml:"append_port" form:"append_port"`

	Token string `yaml:"token" form:"token"`

	ServeHTTPS bool   `yaml:"serve_https" form:"serve_https"`
	SSLCert    string `yaml:"ssl_cert" form:"ssl_cert"`
	SSLPrivKey string `yaml:"ssl_private_key" form:"ssl_private_key"`

	UploadDir    string  `yaml:"upload_dir" form:"upload_dir"`
	DB           string  `yaml:"db" form:"db"`
	UniURILength int     `yaml:"uniuri_length" form:"uniuri_length"`
	KeyLength    int     `yaml:"key_length" form:"key_length"`
	SizeLimit    int64   `yaml:"size_limit" form:"size_limit"`
	ViewLimit    int64   `yaml:"view_limit" form:"view_limit"`
	DiskQuota    float64 `yaml:"disk_quota" form:"disk_quota"`
	LogLevel     string  `yaml:"loglevel" form:"loglevel"`

	Stats             bool `yaml:"stats" form:"stats"`
	SensitiveMode     bool `yaml:"sensitive_mode" form:"sensitive_mode"`
	NoWeb             bool `yaml:"no_web" form:"no_web"`
	FullDoc           bool `yaml:"fulldoc" form:"fulldoc"`
	AlwaysDownload    bool `yaml:"always_download" form:"always_download"`
	DisableEncryption bool `yaml:"disable_encryption" form:"disable_encryption"`
	PrometheusEnabled bool `yaml:"prometheus_enabled" form:"prometheus_enabled"`
}

UnparsedConf is the configuration when it's still unparsed properly

Jump to

Keyboard shortcuts

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