config

package
v0.0.0-...-5fc674c Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAssetPath

func GetAssetPath() string

GetAssetPath 静态资源路径

func GetLogFormat

func GetLogFormat() string

GetLogFormat 获取应用的日志格式

func GetLogLevel

func GetLogLevel() log.Lvl

GetLogLevel 日志等级

func GetLogTimeFormat

func GetLogTimeFormat() string

GetLogTimeFormat 日志时间格式

func GetRootPath

func GetRootPath() string

GetRootPath 返回项目根目录

func GetSpecialViewPathList

func GetSpecialViewPathList(paths ...string) []string

GetSpecialViewPathList 获取一批path地址

func GetViewTmplPath

func GetViewTmplPath(path string) string

GetViewTmplPath 视图地址, assets/views/path

func GetWisdomFilename

func GetWisdomFilename() string

GetWisdomFilename 获取wisdom文件

func RootPath

func RootPath(paths ...any) string

RootPath 返回path=routePath/subPath

Types

type AppConfig

type AppConfig struct {
	RootPath string `yaml:"root_path"` // 配置文件
	Log      struct {
		LogLevel      string `yaml:"log_level"`  // 日志等级(debug, info, error)
		LogFormat     string `yaml:"log_format"` // 日志格式
		LogTimeFormat string `yaml:"log_time_format"`
	} `yaml:"log"`
	Assets struct {
		AssetPath string `yaml:"asset_path"` // 静态资源path
		ViewPath  string `yaml:"view_path"`  // 视图资源path
	} `yaml:"assets"`
	Wisdom struct {
		FileType string `yaml:"file_type"` // 后期考虑DB、Http文件
		FileName string `yaml:"file_name"` // 文件名称(目前默认为本地文件)
	}
}

AppConfig 应用配置

type ServerConfig

type ServerConfig struct {
	App    *AppConfig `yaml:"app"`
	Listen string     `yaml:"listen"` // 监听
}

ServerConfig wisdom-httpd服务配置

func ParseConfig

func ParseConfig(filename string) (cfg *ServerConfig, err error)

ParseConfig 解析系统配置

Jump to

Keyboard shortcuts

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