main.go 689 B

1234567891011121314151617181920212223242526272829
  1. package server
  2. import (
  3. _ "go.uber.org/automaxprocs"
  4. "go.uber.org/zap"
  5. "server/core"
  6. "server/global"
  7. "server/initialize"
  8. )
  9. // InitBackend initializes the Go backend (Viper, Zap, GORM, Gin) and starts the
  10. // HTTP server in a background goroutine. It does not block. Call this before
  11. // running the Wails application.
  12. func InitBackend() {
  13. global.GVA_VP = core.Viper()
  14. initialize.OtherInit()
  15. global.GVA_LOG = core.Zap()
  16. zap.ReplaceGlobals(global.GVA_LOG)
  17. global.GVA_DB = initialize.Gorm()
  18. initialize.Timer()
  19. initialize.DBList()
  20. if global.GVA_DB != nil {
  21. initialize.RegisterTables()
  22. initialize.SeedSystemData()
  23. }
  24. initialize.InitUHFDevices()
  25. go core.RunWindowsServer()
  26. }