Files
PLG-MuDiCS/display/main.go
T

35 lines
724 B
Go

package main
import (
"log/slog"
"os"
"plg-mudics/display/browser"
"plg-mudics/display/pkg"
"plg-mudics/display/web"
)
//go:generate go tool templ generate
func main() {
var err error
// Ensure local config directory exists
_, err = pkg.GetStoragePath()
if err != nil {
slog.Error("Failed to get storage path", "error", err)
os.Exit(1)
return
}
port := "1323"
// the order is important, the open browser command exitsts as soon as the winodw is closed
// and since its the last action in the main go func all other goroutines (e.g. the webserver) are killed
go web.StartWebServer(port)
browser.Browser.Init()
pkg.OpenStartScreen()
defer browser.Browser.Cancel()
<-browser.Browser.Ctx.Done()
}