config

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2022 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Config = Configure{
	Node:     "root",
	Data:     "data",
	Web:      WebDefault,
	Database: DatabaseDefault,
	History:  HistoryDefault,
	Log:      LogDefault,
}

Config 全局配置

View Source
var DatabaseDefault = Database{
	Type:     "sqlite",
	URL:      "sqlite3.db",
	Debug:    false,
	LogLevel: 4,
}
View Source
var HistoryDefault = History{
	Type:    "embed",
	Options: helper.Options{"data_path": "history"},
}
View Source
var LogDefault = Log{
	Text:  false,
	Level: "error",
	Output: LogOutput{
		Filename: "log.txt",
	},
}
View Source
var WebDefault = Web{
	Addr:     ":8080",
	Debug:    false,
	Compress: true,
}

Functions

func Load

func Load() error

Load 加载

func Store

func Store() error

Types

type Configure

type Configure struct {
	Node     string   `yaml:"node"`
	Data     string   `yaml:"data"`
	Web      Web      `yaml:"web"`
	Database Database `yaml:"database"`
	History  History  `yaml:"history"`
	Log      Log      `yaml:"log"`
}

Configure 配置

type Database added in v1.1.0

type Database struct {
	Type     string `yaml:"type"`
	URL      string `yaml:"url"`
	Debug    bool   `yaml:"debug"`
	LogLevel int    `json:"log_level"`
}

Database 参数

type History added in v1.1.0

type History struct {
	Type    string         `yaml:"type"`
	Options helper.Options `yaml:"options"`
}

History 参数

type Log added in v1.1.0

type Log struct {
	Text   bool      `yaml:"text"`
	Format string    `yaml:"format,omitempty"`
	Level  string    `yaml:"level"`
	Output LogOutput `yaml:"output"`
}

Log 参数

type LogOutput added in v1.1.0

type LogOutput struct {
	Filename   string `yaml:"filename"`
	MaxSize    int    `yaml:"max_size"`
	MaxAge     int    `yaml:"max_age"`
	MaxBackups int    `yaml:"max_backups"`
}

type Web added in v1.1.0

type Web struct {
	Addr     string `yaml:"addr"`
	Debug    bool   `yaml:"debug,omitempty"`
	Compress bool   `json:"compress"`
}

Web 参数

Jump to

Keyboard shortcuts

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