config

package
v0.0.0-...-33c5ed1 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2023 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conf

type Conf struct {
	// 版本
	Version string `yaml:"-"`
	// 配置文件目录
	ConfigDir string `yaml:"-"`
	// 运行模式
	Runmode string `yaml:"runmode"`
	LogDir  string `json:"log_dir" yaml:"log_dir"` // 日志地址
	Http    struct {
		Port    int `json:"port" yaml:"port"` // 端口
		Captcha struct {
			Enable   bool `yaml:"enable"`   // 是否需要验证码(仅密码登录有效)
			Length   int  `yaml:"length"`   // 长度 4-8  (默认 4)
			Duration int  `yaml:"duration"` // 有效期  单位秒 (默认 180)
		} `yaml:"captcha"` // 验证码配置
		TokenDuration        int    `yaml:"token_duration"`         // token有效期
		DefaultPasswordMode  string `yaml:"default_password_mode"`  // 默认密码模式  目前仅支持固定密码 (后续可以加上正则或字段值什么的)
		DefaultPasswordValue string `yaml:"default_password_value"` // 默认密码
	} `json:"http" yaml:"http"`
	DB      db.Config      `json:"db" yaml:"db"`
	Storage storage.Config `json:"storage" yaml:"storage"`
}

配置文件

func LoadConfig

func LoadConfig(path string) (*Conf, error)

载入配置

Jump to

Keyboard shortcuts

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