feat: open url at startup

This commit is contained in:
Simon Ding
2024-09-29 13:55:16 +08:00
parent 2683c5dbf2
commit ce25c090f5
2 changed files with 52 additions and 0 deletions

View File

@@ -3,8 +3,10 @@ package main
import (
"polaris/db"
"polaris/log"
"polaris/pkg/utils"
"polaris/server"
"syscall"
"time"
)
func main() {
@@ -17,6 +19,13 @@ func main() {
log.Panicf("init db error: %v", err)
}
go func() {
time.Sleep(2 * time.Second)
if err := utils.OpenURL("http://127.0.0.1:8080"); err != nil {
log.Errorf("open url error: %v", err)
}
}()
s := server.NewServer(dbClient)
if err := s.Serve(); err != nil {
log.Errorf("server start error: %v", err)