@@ -1,7 +1,7 @@
|
||||
package command
|
||||
|
||||
import (
|
||||
"github.com/owncloud/ocis/notifications/pkg/config"
|
||||
"github.com/owncloud/ocis/audit/pkg/config"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"context"
|
||||
"os"
|
||||
|
||||
"github.com/owncloud/ocis/notifications/pkg/config"
|
||||
"github.com/owncloud/ocis/audit/pkg/config"
|
||||
"github.com/owncloud/ocis/ocis-pkg/clihelper"
|
||||
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
|
||||
"github.com/thejerf/suture/v4"
|
||||
@@ -25,11 +25,11 @@ func GetCommands(cfg *config.Config) cli.Commands {
|
||||
}
|
||||
}
|
||||
|
||||
// Execute is the entry point for the notifications command.
|
||||
// Execute is the entry point for the audit command.
|
||||
func Execute(cfg *config.Config) error {
|
||||
app := clihelper.DefaultApp(&cli.App{
|
||||
Name: "notifications",
|
||||
Usage: "starts notifications service",
|
||||
Name: "audit",
|
||||
Usage: "starts audit service",
|
||||
Commands: GetCommands(cfg),
|
||||
})
|
||||
|
||||
@@ -41,16 +41,16 @@ func Execute(cfg *config.Config) error {
|
||||
return app.Run(os.Args)
|
||||
}
|
||||
|
||||
// SutureService allows for the notifications command to be embedded and supervised by a suture supervisor tree.
|
||||
// SutureService allows for the audit command to be embedded and supervised by a suture supervisor tree.
|
||||
type SutureService struct {
|
||||
cfg *config.Config
|
||||
}
|
||||
|
||||
// NewSutureService creates a new notifications.SutureService
|
||||
// NewSutureService creates a new audit.SutureService
|
||||
func NewSutureService(cfg *ociscfg.Config) suture.Service {
|
||||
cfg.Settings.Commons = cfg.Commons
|
||||
return SutureService{
|
||||
cfg: cfg.Notifications,
|
||||
cfg: cfg.Audit,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,11 +6,10 @@ import (
|
||||
"github.com/asim/go-micro/plugins/events/nats/v4"
|
||||
"github.com/cs3org/reva/v2/pkg/events"
|
||||
"github.com/cs3org/reva/v2/pkg/events/server"
|
||||
"github.com/owncloud/ocis/notifications/pkg/channels"
|
||||
"github.com/owncloud/ocis/notifications/pkg/config"
|
||||
"github.com/owncloud/ocis/notifications/pkg/config/parser"
|
||||
"github.com/owncloud/ocis/notifications/pkg/logging"
|
||||
"github.com/owncloud/ocis/notifications/pkg/service"
|
||||
"github.com/owncloud/ocis/audit/pkg/config"
|
||||
"github.com/owncloud/ocis/audit/pkg/config/parser"
|
||||
"github.com/owncloud/ocis/audit/pkg/logging"
|
||||
svc "github.com/owncloud/ocis/audit/pkg/service"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
@@ -30,7 +29,7 @@ func Server(cfg *config.Config) *cli.Command {
|
||||
events.ShareCreated{},
|
||||
}
|
||||
|
||||
evtsCfg := cfg.Notifications.Events
|
||||
evtsCfg := cfg.Events
|
||||
client, err := server.NewNatsStream(nats.Address(evtsCfg.Endpoint), nats.ClusterID(evtsCfg.Cluster))
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -39,12 +38,9 @@ func Server(cfg *config.Config) *cli.Command {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
channel, err := channels.NewMailChannel(*cfg, logger)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
svc := service.NewEventsNotifier(evts, channel, logger)
|
||||
return svc.Run()
|
||||
|
||||
svc.StartAuditLogger(cfg.Auditlog, evts, logger)
|
||||
return nil
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package command
|
||||
|
||||
import (
|
||||
"github.com/owncloud/ocis/notifications/pkg/config"
|
||||
"github.com/owncloud/ocis/audit/pkg/config"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user