configFiles

package
v1.1.7 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

README

读取配置文件

支持go embed
    可将配置文件嵌入到可执行文件中
本地配置文件优先级高于内嵌文件

如果使用go embed 需在入口main包嵌入以下代码

//go:embed config
var embedConfigFiles embed.FS

func init() {
	_ = os.Setenv("EMBED-CONFIG-FILES", "1")
	tools.SetEmbedConfigDir(embedConfigFiles)
}

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ConfigDir embed.FS

Functions

func GetConfigFile

func GetConfigFile(fileName string) ([]byte, error)

func GetConfigPath

func GetConfigPath(fileName string) string

func SetEmbedConfigDir

func SetEmbedConfigDir(dir embed.FS)

Types

This section is empty.

Jump to

Keyboard shortcuts

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