Skip to content

Commit

Permalink
Removed notification capability, now it is enabled by default
Browse files Browse the repository at this point in the history
  • Loading branch information
glpatcern committed Feb 7, 2024
1 parent ce0bd1e commit 38925fa
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 15 deletions.
2 changes: 1 addition & 1 deletion internal/http/services/owncloud/ocdav/ocdav.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ func New(ctx context.Context, m map[string]interface{}) (global.Service, error)
httpclient.RoundTripper(tr),
),
favoritesManager: fm,
notificationHelper: notificationhelper.New("ocdav", c.Notifications, log),
notificationHelper: notificationhelper.New("ocdav", log),
}

// initialize handlers and set default cigs
Expand Down
1 change: 0 additions & 1 deletion internal/http/services/owncloud/ocs/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ type Config struct {
AllowedLanguages []string `mapstructure:"allowed_languages"`
OCMMountPoint string `mapstructure:"ocm_mount_point"`
ListOCMShares bool `mapstructure:"list_ocm_shares"`
Notifications map[string]interface{} `mapstructure:"notifications"`
}

// Init sets sane defaults.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func (h *Handler) Init(c *config.Config, l *zerolog.Logger) {
h.ocmMountPoint = c.OCMMountPoint
h.listOCMShares = c.ListOCMShares
h.Log = l
h.notificationHelper = notificationhelper.New("ocs", c.Notifications, l)
h.notificationHelper = notificationhelper.New("ocs", l)
h.additionalInfoTemplate, _ = template.New("additionalInfo").Parse(c.AdditionalInfoAttribute)
h.resourceInfoCacheTTL = time.Second * time.Duration(c.ResourceInfoCacheTTL)

Expand Down
14 changes: 2 additions & 12 deletions pkg/notification/notificationhelper/notificationhelper.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func defaultConfig() *Config {
}

// New creates a new Notification Helper.
func New(name string, m map[string]interface{}, log *zerolog.Logger) *NotificationHelper {
func New(name string, log *zerolog.Logger) *NotificationHelper {
annotatedLogger := log.With().Str("service", name).Str("scope", "notifications").Logger()

conf := defaultConfig()
Expand All @@ -67,18 +67,8 @@ func New(name string, m map[string]interface{}, log *zerolog.Logger) *Notificati
Log: &annotatedLogger,
}

if len(m) == 0 {
log.Info().Msgf("no 'notifications' field in service config, notifications will be disabled")
return nh
}

if err := mapstructure.Decode(m, conf); err != nil {
log.Error().Err(err).Msgf("decoding config failed, notifications will be disabled")
return nh
}

if err := nh.connect(); err != nil {
log.Error().Err(err).Msgf("connecting to nats failed, notifications will be disabled")
log.Error().Err(err).Msg("connecting to nats failed, notifications will be disabled")
return nh
}

Expand Down

0 comments on commit 38925fa

Please sign in to comment.