Use sockets for server creation progress

This commit is contained in:
Fran Jurmanović
2025-09-18 01:06:58 +02:00
parent 760412d7db
commit 901dbe697e
17 changed files with 1314 additions and 188 deletions

View File

@@ -104,6 +104,12 @@ func (f *ServerFilter) ApplyFilter(query *gorm.DB) *gorm.DB {
return query
}
func (s *Server) GenerateUUID() {
if s.ID == uuid.Nil {
s.ID = uuid.New()
}
}
// BeforeCreate is a GORM hook that runs before creating a new server
func (s *Server) BeforeCreate(tx *gorm.DB) error {
if s.Name == "" {
@@ -111,9 +117,7 @@ func (s *Server) BeforeCreate(tx *gorm.DB) error {
}
// Generate UUID if not set
if s.ID == uuid.Nil {
s.ID = uuid.New()
}
s.GenerateUUID()
// Generate service name and config path if not set
if s.ServiceName == "" {