Add listen to Unix websocket

This commit is contained in:
Thomas Miceli
2025-06-04 18:44:17 +02:00
parent 3c0115d829
commit ab9382b8b1
4 changed files with 70 additions and 7 deletions

View File

@ -36,11 +36,12 @@ var CmdStart = cli.Command{
Initialize(ctx)
go server.NewServer(os.Getenv("OG_DEV") == "1", path.Join(config.GetHomeDir(), "sessions"), false).Start()
server := server.NewServer(os.Getenv("OG_DEV") == "1", path.Join(config.GetHomeDir(), "sessions"), false)
go server.StartUnixSocket()
go ssh.Start()
<-stopCtx.Done()
shutdown()
shutdown(server)
return nil
},
}
@ -130,7 +131,7 @@ func Initialize(ctx *cli.Context) {
}
}
func shutdown() {
func shutdown(server *server.Server) {
log.Info().Msg("Shutting down database...")
if err := db.Close(); err != nil {
log.Error().Err(err).Msg("Failed to close database")
@ -141,6 +142,8 @@ func shutdown() {
index.Close()
}
server.StopUnixSocket()
log.Info().Msg("Shutdown complete")
}