config

package
v0.0.0-...-a277c89 Latest Latest
Warning

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

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

Documentation

Overview

说明:声明配置属性结构体

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	*viper.Viper
}

func NewConfig

func NewConfig() (cfg *Config, err error)

NewConfig 实例化一个 Config 并设置相关信息

func (*Config) ReadSection

func (cfg *Config) ReadSection(k string, v any) (err error)

ReadSection 将k部分内容读入结构体中 v必须是结构体指针

type DBConfigS

type DBConfigS struct {
	DBtype   string        `mapstructure:"dbtype"`
	Username string        `mapstructure:"username"`
	Password string        `mapstructure:"password"`
	Host     string        `mapstructure:"host"`
	DBName   string        `mapstructure:"dbname"`
	Timeout  time.Duration `mapstructure:"timeout"`
}

DBConfigS 数据库配置信息

type EmailS

type EmailS struct {
	Host     string
	Port     int
	Username string
	Password string
}

Email 邮箱配置 - 用于发送邮件

type ServerConfigS

type ServerConfigS struct {
	RunMode      string        `mapstructure:"runmode"`
	Port         string        `mapstructure:"port"`
	ReadTimeOut  time.Duration `mapstructure:"read_timeout"`
	WriteTimeOut time.Duration `mapstructure:"write_timeout"`
}

ServerConfigS 服务器配置信息

type StorageS

type StorageS struct {
	SavePath       string
	ServerUrl      string
	ImageAllowExts []string
}

Storage 存储配置

Jump to

Keyboard shortcuts

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