config.go 482 B

123456789101112131415161718192021222324252627282930
  1. package config
  2. import (
  3. "fmt"
  4. "os"
  5. "git.sxidc.com/go-framework/baize/framework/core/application"
  6. )
  7. type Config struct {
  8. ApplicationConfig application.Config
  9. }
  10. var conf Config
  11. func init() {
  12. configFilePath := os.Getenv("CONFIG_FILE_PATH")
  13. applicationConfig, err := application.LoadFromYamlFile(configFilePath)
  14. if err != nil {
  15. panic(err)
  16. }
  17. conf.ApplicationConfig = applicationConfig
  18. fmt.Println("Load config file finish")
  19. }
  20. func GetConfig() Config {
  21. return conf
  22. }