Delete the project
(projectID string)
| 218 | |
| 219 | // Delete the project |
| 220 | func (m *Modules) Delete(projectID string) { |
| 221 | m.lock.Lock() |
| 222 | defer m.lock.Unlock() |
| 223 | |
| 224 | if block, p := m.blocks[projectID]; p { |
| 225 | // Close all the modules here |
| 226 | helpers.Logger.LogDebug(helpers.GetRequestID(context.TODO()), "Closing config of auth module", nil) |
| 227 | block.auth.CloseConfig() |
| 228 | |
| 229 | helpers.Logger.LogDebug(helpers.GetRequestID(context.TODO()), "Closing config of db module", nil) |
| 230 | if err := block.db.CloseConfig(); err != nil { |
| 231 | _ = helpers.Logger.LogError(helpers.GetRequestID(context.TODO()), "Error closing db module config", err, map[string]interface{}{"project": projectID}) |
| 232 | } |
| 233 | |
| 234 | helpers.Logger.LogDebug(helpers.GetRequestID(context.TODO()), "Closing config of filestore module", nil) |
| 235 | if err := block.file.CloseConfig(); err != nil { |
| 236 | _ = helpers.Logger.LogError(helpers.GetRequestID(context.TODO()), "Error closing filestore module config", err, map[string]interface{}{"project": projectID}) |
| 237 | } |
| 238 | |
| 239 | helpers.Logger.LogDebug(helpers.GetRequestID(context.TODO()), "Closing config of eventing module", nil) |
| 240 | if err := block.eventing.CloseConfig(); err != nil { |
| 241 | _ = helpers.Logger.LogError(helpers.GetRequestID(context.TODO()), "Error closing eventing module config", err, map[string]interface{}{"project": projectID}) |
| 242 | } |
| 243 | |
| 244 | helpers.Logger.LogDebug(helpers.GetRequestID(context.TODO()), "Closing config of realtime module", nil) |
| 245 | if err := block.realtime.CloseConfig(); err != nil { |
| 246 | _ = helpers.Logger.LogError(helpers.GetRequestID(context.TODO()), "Error closing realtime module config", err, map[string]interface{}{"project": projectID}) |
| 247 | } |
| 248 | } |
| 249 | |
| 250 | delete(m.blocks, projectID) |
| 251 | |
| 252 | // Remove config from global modules |
| 253 | _ = m.LetsEncrypt().DeleteProjectDomains(projectID) |
| 254 | m.Routing().DeleteProjectRoutes(projectID) |
| 255 | } |
| 256 | |
| 257 | func (m *Modules) loadModule(projectID string) (*Module, error) { |
| 258 | m.lock.RLock() |
nothing calls this directly
no test coverage detected