Documentation ¶
Index ¶
Constants ¶
View Source
const ( MegaByte = 1024 * 1024 NoDiags = "no diagnostics" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AppConfig ¶
type AppConfig struct { Name string `hcl:"name,optional" json:"name,omitempty"` Version string `hcl:"version,optional" json:"version,omitempty"` Remain hcl.Body `hcl:",remain"` }
AppConfig App配置,包括App名称和自定义配置
type LogConfig ¶
type LogConfig struct { LogLevel string `hcl:"log_level,optional" json:"log_level,omitempty"` LogFile string `hcl:"log_file,optional" json:"log_file,omitempty"` LogDir string `hcl:"log_dir,optional" json:"log_dir,omitempty"` }
LogConfig 日志配置,指定文件夹或URL文件
type RootConfig ¶
type RootConfig struct { Debug bool `hcl:"debug" json:"debug"` App *AppConfig `hcl:"app,block" json:"app"` Log *LogConfig `hcl:"log,block" json:"log,omitempty"` Remain hcl.Body `hcl:",remain"` // contains filtered or unexported fields }
RootConfig 顶层配置,包含其他配置块
func ReadConfigFile ¶
func ReadConfigFile(file string, remain any) (*RootConfig, error)
ReadConfigFile 读取配置文件
func (*RootConfig) ParseAppRemain ¶ added in v1.4.4
func (c *RootConfig) ParseAppRemain(remain any) error
ParseAppRemain 解析剩下的配置
func (*RootConfig) ParseFile ¶ added in v1.4.4
func (c *RootConfig) ParseFile(force bool) error
ParseFile 解析主要配置
func (*RootConfig) ParseRemain ¶ added in v1.4.4
func (c *RootConfig) ParseRemain(remain any) error
ParseRemain 解析剩下的配置
Click to show internal directories.
Click to hide internal directories.