diff --git a/crm/internal/service/notification.go b/crm/internal/service/notification.go index 2f7318599..7ee2c4d28 100644 --- a/crm/internal/service/notification.go +++ b/crm/internal/service/notification.go @@ -96,7 +96,7 @@ func (s *notification) expandUserRefs(recipients []string) ([]string, error) { // First, get userID off the table if userID, _ := strconv.ParseUint(rcpt, 10, 64); userID > 0 { if user, err := s.userSvc.FindByID(userID); err != nil { - return nil, errors.Wrapf(err, "invalid recipient %v", userID) + return nil, errors.Wrapf(err, "invalid recipient %d", userID) } else { recipients[r] = user.Email + " " + user.Name } diff --git a/crm/internal/service/service.go b/crm/internal/service/service.go index 391e74996..5cbb01218 100644 --- a/crm/internal/service/service.go +++ b/crm/internal/service/service.go @@ -1,9 +1,6 @@ package service import ( - "log" - "sync" - "github.com/crusttech/crust/internal/store" ) @@ -14,7 +11,6 @@ type ( ) var ( - o sync.Once DefaultRecord RecordService DefaultModule ModuleService DefaultTrigger TriggerService @@ -25,20 +21,20 @@ var ( DefaultAttachment AttachmentService ) -func Init() { - o.Do(func() { - fs, err := store.New("var/store") - if err != nil { - log.Fatalf("Failed to initialize store: %v", err) - } +func Init() error { + fs, err := store.New("var/store") + if err != nil { + return err + } - DefaultPermissions = Permissions() - DefaultRecord = Record() - DefaultModule = Module() - DefaultTrigger = Trigger() - DefaultPage = Page() - DefaultChart = Chart() - DefaultNotification = Notification() - DefaultAttachment = Attachment(fs) - }) + DefaultPermissions = Permissions() + DefaultRecord = Record() + DefaultModule = Module() + DefaultTrigger = Trigger() + DefaultPage = Page() + DefaultChart = Chart() + DefaultNotification = Notification() + DefaultAttachment = Attachment(fs) + + return nil }