Add listen to Unix websocket (#484)

This commit is contained in:
Thomas Miceli
2025-08-01 17:34:52 +02:00
committed by GitHub
parent b18cdb9188
commit 979b302e4c
6 changed files with 190 additions and 51 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.Start()
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.Stop()
log.Info().Msg("Shutdown complete")
}