mirror of
https://github.com/openziti/zrok.git
synced 2024-11-07 08:44:14 +01:00
cascade delete services when removing environment
This commit is contained in:
parent
4b70a8a0d3
commit
c0e22792d0
@ -107,6 +107,15 @@ func (self *disableHandler) removeServicesForEnvironment(envId int, tx *sqlx.Tx,
|
||||
}
|
||||
|
||||
func (self *disableHandler) removeEnvironment(envId int, tx *sqlx.Tx) error {
|
||||
svcs, err := str.FindServicesForEnvironment(envId, tx)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "error finding services for environment '%d'", envId)
|
||||
}
|
||||
for _, svc := range svcs {
|
||||
if err := str.DeleteService(svc.Id, tx); err != nil {
|
||||
return errors.Wrapf(err, "error deleting service '%d' for environment '%d'", svc.Id, envId)
|
||||
}
|
||||
}
|
||||
if err := str.DeleteEnvironment(envId, tx); err != nil {
|
||||
return errors.Wrapf(err, "error deleting environment '%d'", envId)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user