panic(fmt.Errorf("unknown message store backend: %q", args.MSBackend)) } } var CreateModules = func(args Args) []interface{} { modules := []interface{}{ server.NewWSHandlerFactory("/stream/"), server.NewRestMessageApi("/api/"), } if args.GcmEnable { if args.GcmApiKey == "" { panic("gcm api key has to be provided, if gcm is enabled") } guble.Info("google cloud messaging: enabled") modules = append(modules, gcm.NewGCMConnector("/gcm/", args.GcmApiKey)) } else { guble.Info("google cloud messaging: disabled") } return modules } func Main() { defer func() { if p := recover(); p != nil { guble.Err("%v", p) os.Exit(1) } }() args := loadArgs()
} else { modules = append(modules, wsHandler) } modules = append(modules, rest.NewRestMessageAPI(router, "/api/")) if *config.GCM.Enabled { if *config.GCM.APIKey == "" { logger.Panic("GCM API Key has to be provided, if GCM is enabled") } logger.Info("Google cloud messaging: enabled") logger.WithField("count", *config.GCM.Workers).Debug("GCM workers") if gcm, err := gcm.NewGCMConnector(router, "/gcm/", *config.GCM.APIKey, *config.GCM.Workers); err != nil { logger.WithField("err", err).Error("Error loading GCMConnector:") } else { modules = append(modules, gcm) } } else { logger.Info("Google cloud messaging: disabled") } return modules } func Main() { config.Parse() defer func() { if p := recover(); p != nil {