23 lines
343 B
Go
23 lines
343 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
|
|
"gitlab.com/go-course-project/go17/book/config"
|
|
)
|
|
|
|
func main() {
|
|
// 从配置文件中加载配置
|
|
// 加载配置
|
|
path := os.Getenv("CONFIG_PATH")
|
|
if path == "" {
|
|
path = "application.yaml"
|
|
}
|
|
config.LoadConfigFromYaml(path)
|
|
|
|
// 访问加载后的配置
|
|
conf := config.Get()
|
|
fmt.Println(conf)
|
|
}
|