config

package
v0.0.0-...-452647d Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2022 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Config = Configure{
	Node:            "root",
	Data:            "data",
	Addr:            ":1206",
	DefaultPassword: "123456",
	Web:             WebDefault,
	Database:        DatabaseDefault,
	Log:             LogDefault,
}

Config 全局配置

View Source
var DatabaseDefault = Database{
	Type:     "sqlite",
	URL:      "sqlite3.db",
	Debug:    false,
	LogLevel: 4,
	Sync:     true,
}
View Source
var LogDefault = Log{
	Level: "trace",
	Text:  false,
}
View Source
var WebDefault = Web{
	Addr:     ":8080",
	Debug:    true,
	Compress: true,
}

Functions

func Existing

func Existing() bool

func Load

func Load() error

Load 加载

func Store

func Store() error

Types

type Configure

type Configure struct {
	Node            string   `yaml:"node" json:"node"`
	Data            string   `yaml:"data" json:"data"`
	Addr            string   `yaml:"addr" json:"addr"`
	DefaultPassword string   `yaml:"default_password" json:"default_password"`
	Web             Web      `yaml:"web" json:"web"`
	Database        Database `yaml:"database" json:"database"`
	Log             Log      `yaml:"log" json:"log"`
}

Configure 配置

type Database

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

Database 参数

type Log

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

Log 参数

type LogOutput

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

type Web

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

Web 参数

Jump to

Keyboard shortcuts

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