Пример #1
0
func (a *App) RegisterBackend(b db.Backend) {
	if b.Logger() == nil {
		b.SetLogger(a.Logger())
	}

	isDefault := a.DefaultBackend() == nil
	a.registry.AddBackend(b)

	// If no backend was registered before, create a default UserService and FileService.
	if isDefault && a.defaults {
		if a.UserService() == nil {
			a.BuildDefaultUserService(b)
		}
		if a.FileService() == nil {
			a.BuildDefaultFileService(b)
		}
		if a.registry.TaskService() == nil {
			a.BuildDefaultTaskService(b)
		}
	}
}