diff --git a/ocis-pkg/handlers/debughandlers.go b/ocis-pkg/handlers/debughandlers.go index 0ac3fed39..ebc6de781 100644 --- a/ocis-pkg/handlers/debughandlers.go +++ b/ocis-pkg/handlers/debughandlers.go @@ -13,7 +13,7 @@ func Health(w http.ResponseWriter, r *http.Request) { // TODO: check if services are up and running _, err := io.WriteString(w, http.StatusText(http.StatusOK)) - // io.WriteString should not fail but if it does we want to know. + // io.WriteString should not fail but if it does, we want to know. if err != nil { panic(err) } @@ -27,7 +27,7 @@ func Ready(w http.ResponseWriter, r *http.Request) { // TODO: check if services are up and running _, err := io.WriteString(w, http.StatusText(http.StatusOK)) - // io.WriteString should not fail but if it does we want to know. + // io.WriteString should not fail but if it does, we want to know. if err != nil { panic(err) } diff --git a/ocis-pkg/log/log.go b/ocis-pkg/log/log.go index 24567189c..8d68b515e 100644 --- a/ocis-pkg/log/log.go +++ b/ocis-pkg/log/log.go @@ -13,8 +13,6 @@ import ( "github.com/rs/zerolog" "github.com/rs/zerolog/log" "go-micro.dev/v4/logger" - - "github.com/owncloud/ocis/v2/ocis-pkg/shared" ) var ( @@ -22,7 +20,7 @@ var ( ) func init() { - // this is ugly, but "logger.DefaultLogger" is a global variable and we need to set it _before_ anybody uses it + // this is ugly, but "logger.DefaultLogger" is a global variable, and we need to set it _before_ anybody uses it setMicroLogger() } @@ -50,17 +48,6 @@ type Logger struct { zerolog.Logger } -// LoggerFromConfig initializes a service-specific logger instance. -func LoggerFromConfig(name string, cfg *shared.Log) Logger { - return NewLogger( - Name(name), - Level(cfg.Level), - Pretty(cfg.Pretty), - Color(cfg.Color), - File(cfg.File), - ) -} - // NopLogger initializes a no-operation logger. func NopLogger() Logger { return Logger{zerolog.Nop()} @@ -71,7 +58,7 @@ type LineInfoHook struct{} // Run is a hook to add line info to log messages. // I found the zerolog example for this here: // https://github.com/rs/zerolog/issues/22#issuecomment-1127295489 -func (h LineInfoHook) Run(e *zerolog.Event, l zerolog.Level, msg string) { +func (h LineInfoHook) Run(e *zerolog.Event, _ zerolog.Level, _ string) { _, file, line, ok := runtime.Caller(3) if ok { e.Str("line", fmt.Sprintf("%s:%d", file, line)) @@ -105,10 +92,10 @@ func NewLogger(opts ...Option) Logger { logLevel = zerolog.ErrorLevel } - var logger zerolog.Logger + var l zerolog.Logger if options.Pretty { - logger = log.Output( + l = log.Output( zerolog.NewConsoleWriter( func(w *zerolog.ConsoleWriter) { w.TimeFormat = time.RFC3339 @@ -123,27 +110,27 @@ func NewLogger(opts ...Option) Logger { print(fmt.Sprintf("file could not be opened for writing: %s. error: %v", options.File, err)) os.Exit(1) } - logger = logger.Output(f) + l = l.Output(f) } else { - logger = zerolog.New(os.Stderr) + l = zerolog.New(os.Stderr) } - logger = logger.With(). + l = l.With(). Str("service", options.Name). Timestamp(). Logger().Level(logLevel) if logLevel <= zerolog.InfoLevel { var lineInfoHook LineInfoHook - logger = logger.Hook(lineInfoHook) + l = l.Hook(lineInfoHook) } return Logger{ - logger, + l, } } -// SubloggerWithRequestID returns a sublogger with the x-request-id added to all events +// SubloggerWithRequestID returns a sub-logger with the x-request-id added to all events func (l Logger) SubloggerWithRequestID(c context.Context) Logger { return Logger{ l.With().Str(RequestIDString, chimiddleware.GetReqID(c)).Logger(), diff --git a/ocis-pkg/log/logrus_wrapper.go b/ocis-pkg/log/logrus_wrapper.go index 3a4a9d68a..1f890e4ea 100644 --- a/ocis-pkg/log/logrus_wrapper.go +++ b/ocis-pkg/log/logrus_wrapper.go @@ -24,7 +24,7 @@ type LogrusWrapper struct { levelMap levelMap } -// Wrap return a logrus logger which internally logs to /dev/null. Messages are passed to the +// LogrusWrap returns a logrus logger which internally logs to /dev/null. Messages are passed to the // underlying zerolog via hooks. func LogrusWrap(zr zerolog.Logger) *logrus.Logger { lr := logrus.New() diff --git a/services/antivirus/pkg/config/config.go b/services/antivirus/pkg/config/config.go index 15f744217..2049d37e2 100644 --- a/services/antivirus/pkg/config/config.go +++ b/services/antivirus/pkg/config/config.go @@ -19,7 +19,7 @@ type Config struct { InfectedFileHandling string `yaml:"infected-file-handling" env:"ANTIVIRUS_INFECTED_FILE_HANDLING" desc:"Defines the behaviour when a virus has been found. Supported options are: 'delete', 'continue' and 'abort '. Delete will delete the file. Continue will mark the file as infected but continues further processing. Abort will keep the file in the uploads folder for further admin inspection and will not move it to its final destination." introductionVersion:"pre5.0"` Events Events Scanner Scanner - MaxScanSize string `yaml:"max-scan-size" env:"ANTIVIRUS_MAX_SCAN_SIZE" desc:"The maximum scan size the virusscanner can handle. Only this many bytes of a file will be scanned. 0 means unlimited and is the default. Usable common abbreviations: [KB, KiB, GB, GiB, TB, TiB, PB, PiB, EB, EiB], example: 2GB." introductionVersion:"pre5.0"` + MaxScanSize string `yaml:"max-scan-size" env:"ANTIVIRUS_MAX_SCAN_SIZE" desc:"The maximum scan size the virus scanner can handle. Only this many bytes of a file will be scanned. 0 means unlimited and is the default. Usable common abbreviations: [KB, KiB, GB, GiB, TB, TiB, PB, PiB, EB, EiB], example: 2GB." introductionVersion:"pre5.0"` Context context.Context `yaml:"-" json:"-"` @@ -58,7 +58,7 @@ type Events struct { AuthPassword string `yaml:"password" env:"OCIS_EVENTS_AUTH_PASSWORD;ANTIVIRUS_EVENTS_AUTH_PASSWORD" desc:"The password to authenticate with the events broker. The events broker is the ocis service which receives and delivers events between the services." introductionVersion:"5.0"` } -// Scanner provides configuration options for the antivirusscanner +// Scanner provides configuration options for the virus scanner type Scanner struct { Type string `yaml:"type" env:"ANTIVIRUS_SCANNER_TYPE" desc:"The antivirus scanner to use. Supported values are 'clamav' and 'icap'." introductionVersion:"pre5.0"` diff --git a/services/antivirus/pkg/scanners/clamav.go b/services/antivirus/pkg/scanners/clamav.go index a9e8acb4e..2706af99b 100644 --- a/services/antivirus/pkg/scanners/clamav.go +++ b/services/antivirus/pkg/scanners/clamav.go @@ -6,7 +6,7 @@ import ( "github.com/dutchcoders/go-clamd" ) -// NewClamAV returns an Scanner talking to clamAV via socket +// NewClamAV returns a Scanner talking to clamAV via socket func NewClamAV(socket string) *ClamAV { return &ClamAV{ clamd: clamd.NewClamd(socket), diff --git a/services/app-provider/pkg/logging/logging.go b/services/app-provider/pkg/logging/logging.go index d288439ea..cf1470f49 100644 --- a/services/app-provider/pkg/logging/logging.go +++ b/services/app-provider/pkg/logging/logging.go @@ -5,7 +5,7 @@ import ( "github.com/owncloud/ocis/v2/services/app-provider/pkg/config" ) -// LoggerFromConfig initializes a service-specific logger instance. +// Configure initializes a service-specific logger instance. func Configure(name string, cfg *config.Log) log.Logger { return log.NewLogger( log.Name(name), diff --git a/services/app-provider/pkg/server/debug/server.go b/services/app-provider/pkg/server/debug/server.go index 69ac3bd16..598a8e2f5 100644 --- a/services/app-provider/pkg/server/debug/server.go +++ b/services/app-provider/pkg/server/debug/server.go @@ -39,7 +39,7 @@ func health(cfg *config.Config) func(http.ResponseWriter, *http.Request) { // TODO: check if services are up and running _, err := io.WriteString(w, http.StatusText(http.StatusOK)) - // io.WriteString should not fail but if it does we want to know. + // io.WriteString should not fail but if it does, we want to know. if err != nil { panic(err) } @@ -55,7 +55,7 @@ func ready(cfg *config.Config) func(http.ResponseWriter, *http.Request) { // TODO: check if services are up and running _, err := io.WriteString(w, http.StatusText(http.StatusOK)) - // io.WriteString should not fail but if it does we want to know. + // io.WriteString should not fail but if it does, we want to know. if err != nil { panic(err) } diff --git a/services/app-registry/pkg/logging/logging.go b/services/app-registry/pkg/logging/logging.go index bf5737a49..d07c2a1d4 100644 --- a/services/app-registry/pkg/logging/logging.go +++ b/services/app-registry/pkg/logging/logging.go @@ -5,7 +5,7 @@ import ( "github.com/owncloud/ocis/v2/services/app-registry/pkg/config" ) -// LoggerFromConfig initializes a service-specific logger instance. +// Configure initializes a service-specific logger instance. func Configure(name string, cfg *config.Log) log.Logger { return log.NewLogger( log.Name(name), diff --git a/services/app-registry/pkg/server/debug/server.go b/services/app-registry/pkg/server/debug/server.go index 1b172de6e..e85c77274 100644 --- a/services/app-registry/pkg/server/debug/server.go +++ b/services/app-registry/pkg/server/debug/server.go @@ -39,7 +39,7 @@ func health(cfg *config.Config) func(http.ResponseWriter, *http.Request) { // TODO: check if services are up and running _, err := io.WriteString(w, http.StatusText(http.StatusOK)) - // io.WriteString should not fail but if it does we want to know. + // io.WriteString should not fail but if it does, we want to know. if err != nil { panic(err) } @@ -55,7 +55,7 @@ func ready(cfg *config.Config) func(http.ResponseWriter, *http.Request) { // TODO: check if services are up and running _, err := io.WriteString(w, http.StatusText(http.StatusOK)) - // io.WriteString should not fail but if it does we want to know. + // io.WriteString should not fail but if it does, we want to know. if err != nil { panic(err) } diff --git a/services/audit/pkg/service/service_test.go b/services/audit/pkg/service/service_test.go index c8cdd723a..ee98998f5 100644 --- a/services/audit/pkg/service/service_test.go +++ b/services/audit/pkg/service/service_test.go @@ -561,7 +561,7 @@ var testCases = []struct { } func TestAuditLogging(t *testing.T) { - log := log.NewLogger() + l := log.NewLogger() inch := make(chan events.Event) defer close(inch) @@ -572,7 +572,7 @@ func TestAuditLogging(t *testing.T) { ctx, cancel := context.WithCancel(context.TODO()) defer cancel() - go StartAuditLogger(ctx, inch, log, Marshal("json", log), func(b []byte) { + go StartAuditLogger(ctx, inch, l, Marshal("json", l), func(b []byte) { outch <- b }) diff --git a/services/audit/pkg/types/messages.go b/services/audit/pkg/types/messages.go index d8cb503d9..020bc0da3 100644 --- a/services/audit/pkg/types/messages.go +++ b/services/audit/pkg/types/messages.go @@ -53,151 +53,151 @@ const ( ActionGroupMemberRemoved = "group_member_removed" ) -// MessageShareCreated returns the human readable string that describes the action +// MessageShareCreated returns the human-readable string that describes the action func MessageShareCreated(sharer, item, grantee string) string { return fmt.Sprintf("user '%s' shared file '%s' with '%s'", sharer, item, grantee) } -// MessageLinkCreated returns the human readable string that describes the action -func MessageLinkCreated(sharer, item, shareid string) string { - return fmt.Sprintf("user '%s' created a public link to file '%s' with id '%s'", sharer, item, shareid) +// MessageLinkCreated returns the human-readable string that describes the action +func MessageLinkCreated(sharer, item, shareID string) string { + return fmt.Sprintf("user '%s' created a public link to file '%s' with id '%s'", sharer, item, shareID) } -// MessageShareUpdated returns the human readable string that describes the action +// MessageShareUpdated returns the human-readable string that describes the action func MessageShareUpdated(sharer, shareID, fieldUpdated string) string { return fmt.Sprintf("user '%s' updated field '%s' of share '%s'", sharer, fieldUpdated, shareID) } -// MessageLinkUpdated returns the human readable string that describes the action -func MessageLinkUpdated(sharer, shareid, fieldUpdated string) string { - return fmt.Sprintf("user '%s' updated field '%s' of public link '%s'", sharer, fieldUpdated, shareid) +// MessageLinkUpdated returns the human-readable string that describes the action +func MessageLinkUpdated(sharer, shareID, fieldUpdated string) string { + return fmt.Sprintf("user '%s' updated field '%s' of public link '%s'", sharer, fieldUpdated, shareID) } -// MessageShareRemoved returns the human readable string that describes the action -func MessageShareRemoved(sharer, shareid, itemid string) string { - return fmt.Sprintf("share id:'%s' uid:'%s' item-id:'%s' was removed", shareid, sharer, itemid) +// MessageShareRemoved returns the human-readable string that describes the action +func MessageShareRemoved(sharer, shareID, itemid string) string { + return fmt.Sprintf("share id:'%s' uid:'%s' item-id:'%s' was removed", shareID, sharer, itemid) } -// MessageLinkRemoved returns the human readable string that describes the action -func MessageLinkRemoved(executant, shareid string) string { - return fmt.Sprintf("user '%s' removed public link with id:'%s'", executant, shareid) +// MessageLinkRemoved returns the human-readable string that describes the action +func MessageLinkRemoved(executant, shareID string) string { + return fmt.Sprintf("user '%s' removed public link with id:'%s'", executant, shareID) } -// MessageShareAccepted returns the human readable string that describes the action -func MessageShareAccepted(userid, shareid, sharerid string) string { - return fmt.Sprintf("user '%s' accepted share '%s' from user '%s'", userid, shareid, sharerid) +// MessageShareAccepted returns the human-readable string that describes the action +func MessageShareAccepted(userid, shareID, sharerID string) string { + return fmt.Sprintf("user '%s' accepted share '%s' from user '%s'", userid, shareID, sharerID) } -// MessageShareDeclined returns the human readable string that describes the action -func MessageShareDeclined(userid, shareid, sharerid string) string { - return fmt.Sprintf("user '%s' declined share '%s' from user '%s'", userid, shareid, sharerid) +// MessageShareDeclined returns the human-readable string that describes the action +func MessageShareDeclined(userid, shareID, sharerID string) string { + return fmt.Sprintf("user '%s' declined share '%s' from user '%s'", userid, shareID, sharerID) } -// MessageLinkAccessed returns the human readable string that describes the action +// MessageLinkAccessed returns the human-readable string that describes the action func MessageLinkAccessed(token string, success bool) string { return fmt.Sprintf("link with token '%s' was accessed. Success: %v", token, success) } -// MessageContainerCreated returns the human readable string that describes the action +// MessageContainerCreated returns the human-readable string that describes the action func MessageContainerCreated(executant, item string) string { return fmt.Sprintf("user '%s' created folder '%s'", executant, item) } -// MessageFileCreated returns the human readable string that describes the action +// MessageFileCreated returns the human-readable string that describes the action func MessageFileCreated(executant, item string) string { return fmt.Sprintf("user '%s' created file '%s'", executant, item) } -// MessageFileRead returns the human readable string that describes the action +// MessageFileRead returns the human-readable string that describes the action func MessageFileRead(executant, item string) string { return fmt.Sprintf("user '%s' read file '%s'", executant, item) } -// MessageFileTrashed returns the human readable string that describes the action +// MessageFileTrashed returns the human-readable string that describes the action func MessageFileTrashed(executant, item string) string { return fmt.Sprintf("user '%s' trashed file '%s'", executant, item) } -// MessageFileRenamed returns the human readable string that describes the action +// MessageFileRenamed returns the human-readable string that describes the action func MessageFileRenamed(executant, item, oldpath, newpath string) string { return fmt.Sprintf("user '%s' moved file '%s' from '%s' to '%s'", executant, item, oldpath, newpath) } -// MessageFilePurged returns the human readable string that describes the action +// MessageFilePurged returns the human-readable string that describes the action func MessageFilePurged(executant, item string) string { return fmt.Sprintf("user '%s' removed file '%s' from trashbin", executant, item) } -// MessageFileRestored returns the human readable string that describes the action +// MessageFileRestored returns the human-readable string that describes the action func MessageFileRestored(executant, item, path string) string { return fmt.Sprintf("user '%s' restored file '%s' from trashbin to '%s'", executant, item, path) } -// MessageFileVersionRestored returns the human readable string that describes the action +// MessageFileVersionRestored returns the human-readable string that describes the action func MessageFileVersionRestored(executant, item, version string) string { return fmt.Sprintf("user '%s' restored file '%s' in version '%s'", executant, item, version) } -// MessageSpaceCreated returns the human readable string that describes the action +// MessageSpaceCreated returns the human-readable string that describes the action func MessageSpaceCreated(executant, spaceID, name string) string { storagID, spaceID := storagespace.SplitStorageID(spaceID) return fmt.Sprintf("user '%s' created a space '%s' with name '%s' (storage: '%s')", executant, spaceID, name, storagID) } -// MessageSpaceRenamed returns the human readable string that describes the action +// MessageSpaceRenamed returns the human-readable string that describes the action func MessageSpaceRenamed(executant, spaceID, name string) string { storagID, spaceID := storagespace.SplitStorageID(spaceID) return fmt.Sprintf("user '%s' renamed space '%s' to '%s' (storage: '%s')", executant, spaceID, name, storagID) } -// MessageSpaceDisabled returns the human readable string that describes the action +// MessageSpaceDisabled returns the human-readable string that describes the action func MessageSpaceDisabled(executant, spaceID string) string { storagID, spaceID := storagespace.SplitStorageID(spaceID) return fmt.Sprintf("user '%s' disabled the space '%s' (storage: '%s')", executant, spaceID, storagID) } -// MessageSpaceEnabled returns the human readable string that describes the action +// MessageSpaceEnabled returns the human-readable string that describes the action func MessageSpaceEnabled(executant, spaceID string) string { storagID, spaceID := storagespace.SplitStorageID(spaceID) return fmt.Sprintf("user '%s' (re-) enabled the space '%s' (storage: '%s')", executant, spaceID, storagID) } -// MessageSpaceDeleted returns the human readable string that describes the action +// MessageSpaceDeleted returns the human-readable string that describes the action func MessageSpaceDeleted(executant, spaceID string) string { storagID, spaceID := storagespace.SplitStorageID(spaceID) return fmt.Sprintf("user '%s' deleted the space '%s' (storage: '%s')", executant, spaceID, storagID) } -// MessageSpaceShared returns the human readable string that describes the action +// MessageSpaceShared returns the human-readable string that describes the action func MessageSpaceShared(executant, spaceID, grantee string) string { storagID, spaceID := storagespace.SplitStorageID(spaceID) return fmt.Sprintf("user '%s' shared the space '%s' with '%s' (storage: '%s')", executant, spaceID, grantee, storagID) } -// MessageSpaceUnshared returns the human readable string that describes the action +// MessageSpaceUnshared returns the human-readable string that describes the action func MessageSpaceUnshared(executant, spaceID, grantee string) string { storagID, spaceID := storagespace.SplitStorageID(spaceID) return fmt.Sprintf("user '%s' unshared the space '%s' with '%s' (storage: '%s')", executant, spaceID, grantee, storagID) } -// MessageSpaceUpdated returns the human readable string that describes the action +// MessageSpaceUpdated returns the human-readable string that describes the action func MessageSpaceUpdated(executant, spaceID, name string, quota uint64, opaque map[string]string) string { storagID, spaceID := storagespace.SplitStorageID(spaceID) return fmt.Sprintf("user '%s' updated space '%s'. name: '%s', quota: '%d', opaque: '%s' (storage: '%s')", executant, spaceID, name, quota, opaque, storagID) } -// MessageUserCreated returns the human readable string that describes the action +// MessageUserCreated returns the human-readable string that describes the action func MessageUserCreated(executant, userID string) string { return fmt.Sprintf("user '%s' created the user '%s'", executant, userID) } -// MessageUserDeleted returns the human readable string that describes the action +// MessageUserDeleted returns the human-readable string that describes the action func MessageUserDeleted(executant, userID string) string { return fmt.Sprintf("user '%s' deleted the user '%s'", executant, userID) } -// MessageUserFeatureChanged returns the human readable string that describes the action +// MessageUserFeatureChanged returns the human-readable string that describes the action func MessageUserFeatureChanged(executant, userID string, features []events.UserFeature) string { // Result is: "user '%executant%' changed user %username%'s features: %featurename%=%featurevalue% %featurename%=%featurevalue%" var sb strings.Builder @@ -215,22 +215,22 @@ func MessageUserFeatureChanged(executant, userID string, features []events.UserF return sb.String() } -// MessageGroupCreated returns the human readable string that describes the action +// MessageGroupCreated returns the human-readable string that describes the action func MessageGroupCreated(executant, groupID string) string { return fmt.Sprintf("user '%s' created group '%s'", executant, groupID) } -// MessageGroupDeleted returns the human readable string that describes the action +// MessageGroupDeleted returns the human-readable string that describes the action func MessageGroupDeleted(executant, groupID string) string { return fmt.Sprintf("user '%s' deleted group '%s'", executant, groupID) } -// MessageGroupMemberAdded returns the human readable string that describes the action +// MessageGroupMemberAdded returns the human-readable string that describes the action func MessageGroupMemberAdded(executant, userID, groupID string) string { return fmt.Sprintf("user '%s' added user '%s' was added to group '%s'", executant, userID, groupID) } -// MessageGroupMemberRemoved returns the human readable string that describes the action +// MessageGroupMemberRemoved returns the human-readable string that describes the action func MessageGroupMemberRemoved(executant, userID, groupID string) string { return fmt.Sprintf("user '%s' added user '%s' was removed from group '%s'", executant, userID, groupID) } diff --git a/services/audit/pkg/types/types.go b/services/audit/pkg/types/types.go index e3b96f878..1f4d8b250 100644 --- a/services/audit/pkg/types/types.go +++ b/services/audit/pkg/types/types.go @@ -28,7 +28,7 @@ type AuditEventSharing struct { FileID string // The file identifier for the item shared. Owner string // The UID of the owner of the shared item. Path string // The path to the shared item. - ShareID string // The sharing identifier. (not available for public_link_accessed or when recipient unshares) + ShareID string // The sharing identifier. (not available for public_link_accessed or when recipient un-shares) } // AuditEventShareCreated is the event logged when a share is created @@ -91,7 +91,7 @@ type AuditEventLinkAccessed struct { type AuditEventFiles struct { AuditEvent - Path string // The full path to the create file. + Path string // The full path to the created file. Owner string // The UID of the owner of the file. FileID string // The newly created files identifier. } @@ -137,12 +137,12 @@ type AuditEventFileRenamed struct { OldPath string } -// AuditEventFilePurged is the event logged when a file is purged (deleted from trashbin) +// AuditEventFilePurged is the event logged when a file is purged (deleted from trash-bin) type AuditEventFilePurged struct { AuditEventFiles } -// AuditEventFileRestored is the event logged when a file is restored (from trashbin) +// AuditEventFileRestored is the event logged when a file is restored (from trash-bin) type AuditEventFileRestored struct { AuditEventFiles diff --git a/services/auth-basic/pkg/command/server.go b/services/auth-basic/pkg/command/server.go index d7e9f8dff..3a7aaf312 100644 --- a/services/auth-basic/pkg/command/server.go +++ b/services/auth-basic/pkg/command/server.go @@ -43,8 +43,8 @@ func Server(cfg *config.Config) *cli.Command { defer cancel() - // the reva runtime calls os.Exit in the case of a failure and there is no way for the oCIS - // runtime to catch it and restart a reva service. Therefore we need to ensure the service has + // the reva runtime calls `os.Exit` in the case of a failure and there is no way for the oCIS + // runtime to catch it and restart a reva service. Therefore, we need to ensure the service has // everything it needs, before starting the service. // In this case: CA certificates if cfg.AuthProvider == "ldap" { diff --git a/services/auth-basic/pkg/logging/logging.go b/services/auth-basic/pkg/logging/logging.go index 004f3523f..07957bcd7 100644 --- a/services/auth-basic/pkg/logging/logging.go +++ b/services/auth-basic/pkg/logging/logging.go @@ -5,7 +5,7 @@ import ( "github.com/owncloud/ocis/v2/services/auth-basic/pkg/config" ) -// LoggerFromConfig initializes a service-specific logger instance. +// Configure initializes a service-specific logger instance. func Configure(name string, cfg *config.Log) log.Logger { return log.NewLogger( log.Name(name), diff --git a/services/auth-basic/pkg/server/debug/server.go b/services/auth-basic/pkg/server/debug/server.go index 62dafeab8..18b2b02df 100644 --- a/services/auth-basic/pkg/server/debug/server.go +++ b/services/auth-basic/pkg/server/debug/server.go @@ -39,7 +39,7 @@ func health(cfg *config.Config) func(http.ResponseWriter, *http.Request) { // TODO: check if services are up and running _, err := io.WriteString(w, http.StatusText(http.StatusOK)) - // io.WriteString should not fail but if it does we want to know. + // io.WriteString should not fail but if it does, we want to know. if err != nil { panic(err) } @@ -55,7 +55,7 @@ func ready(cfg *config.Config) func(http.ResponseWriter, *http.Request) { // TODO: check if services are up and running _, err := io.WriteString(w, http.StatusText(http.StatusOK)) - // io.WriteString should not fail but if it does we want to know. + // io.WriteString should not fail but if it does, we want to know. if err != nil { panic(err) } diff --git a/services/auth-bearer/pkg/logging/logging.go b/services/auth-bearer/pkg/logging/logging.go index 8b55220f5..e4ebcff3c 100644 --- a/services/auth-bearer/pkg/logging/logging.go +++ b/services/auth-bearer/pkg/logging/logging.go @@ -5,7 +5,7 @@ import ( "github.com/owncloud/ocis/v2/services/auth-bearer/pkg/config" ) -// LoggerFromConfig initializes a service-specific logger instance. +// Configure initializes a service-specific logger instance. func Configure(name string, cfg *config.Log) log.Logger { return log.NewLogger( log.Name(name), diff --git a/services/auth-bearer/pkg/server/debug/server.go b/services/auth-bearer/pkg/server/debug/server.go index a44400a04..fb65e4e16 100644 --- a/services/auth-bearer/pkg/server/debug/server.go +++ b/services/auth-bearer/pkg/server/debug/server.go @@ -39,7 +39,7 @@ func health(cfg *config.Config) func(http.ResponseWriter, *http.Request) { // TODO: check if services are up and running _, err := io.WriteString(w, http.StatusText(http.StatusOK)) - // io.WriteString should not fail but if it does we want to know. + // io.WriteString should not fail but if it does, we want to know. if err != nil { panic(err) } @@ -55,7 +55,7 @@ func ready(cfg *config.Config) func(http.ResponseWriter, *http.Request) { // TODO: check if services are up and running _, err := io.WriteString(w, http.StatusText(http.StatusOK)) - // io.WriteString should not fail but if it does we want to know. + // io.WriteString should not fail but if it does, we want to know. if err != nil { panic(err) } diff --git a/services/auth-machine/pkg/logging/logging.go b/services/auth-machine/pkg/logging/logging.go index f46568ba1..2b3cffb4e 100644 --- a/services/auth-machine/pkg/logging/logging.go +++ b/services/auth-machine/pkg/logging/logging.go @@ -5,7 +5,7 @@ import ( "github.com/owncloud/ocis/v2/services/auth-machine/pkg/config" ) -// LoggerFromConfig initializes a service-specific logger instance. +// Configure initializes a service-specific logger instance. func Configure(name string, cfg *config.Log) log.Logger { return log.NewLogger( log.Name(name), diff --git a/services/auth-machine/pkg/server/debug/server.go b/services/auth-machine/pkg/server/debug/server.go index d2f3b1fc4..4f7323733 100644 --- a/services/auth-machine/pkg/server/debug/server.go +++ b/services/auth-machine/pkg/server/debug/server.go @@ -39,7 +39,7 @@ func health(cfg *config.Config) func(http.ResponseWriter, *http.Request) { // TODO: check if services are up and running _, err := io.WriteString(w, http.StatusText(http.StatusOK)) - // io.WriteString should not fail but if it does we want to know. + // io.WriteString should not fail but if it does, we want to know. if err != nil { panic(err) } @@ -55,7 +55,7 @@ func ready(cfg *config.Config) func(http.ResponseWriter, *http.Request) { // TODO: check if services are up and running _, err := io.WriteString(w, http.StatusText(http.StatusOK)) - // io.WriteString should not fail but if it does we want to know. + // io.WriteString should not fail but if it does, we want to know. if err != nil { panic(err) } diff --git a/services/auth-service/pkg/logging/logging.go b/services/auth-service/pkg/logging/logging.go index 79b966fd2..46345d8d9 100644 --- a/services/auth-service/pkg/logging/logging.go +++ b/services/auth-service/pkg/logging/logging.go @@ -5,7 +5,7 @@ import ( "github.com/owncloud/ocis/v2/services/auth-service/pkg/config" ) -// LoggerFromConfig initializes a service-specific logger instance. +// Configure initializes a service-specific logger instance. func Configure(name string, cfg *config.Log) log.Logger { return log.NewLogger( log.Name(name), diff --git a/services/auth-service/pkg/server/debug/server.go b/services/auth-service/pkg/server/debug/server.go index faedc717b..d4616cb0f 100644 --- a/services/auth-service/pkg/server/debug/server.go +++ b/services/auth-service/pkg/server/debug/server.go @@ -39,7 +39,7 @@ func health(cfg *config.Config) func(http.ResponseWriter, *http.Request) { // TODO: check if services are up and running _, err := io.WriteString(w, http.StatusText(http.StatusOK)) - // io.WriteString should not fail but if it does we want to know. + // io.WriteString should not fail but if it does, we want to know. if err != nil { panic(err) } @@ -55,7 +55,7 @@ func ready(cfg *config.Config) func(http.ResponseWriter, *http.Request) { // TODO: check if services are up and running _, err := io.WriteString(w, http.StatusText(http.StatusOK)) - // io.WriteString should not fail but if it does we want to know. + // io.WriteString should not fail but if it does, we want to know. if err != nil { panic(err) } diff --git a/services/clientlog/pkg/command/server.go b/services/clientlog/pkg/command/server.go index 2558befb1..a2506e7b0 100644 --- a/services/clientlog/pkg/command/server.go +++ b/services/clientlog/pkg/command/server.go @@ -63,7 +63,7 @@ func Server(cfg *config.Config) *cli.Command { defer cancel() - stream, err := stream.NatsFromConfig(cfg.Service.Name, false, stream.NatsConfig(cfg.Events)) + s, err := stream.NatsFromConfig(cfg.Service.Name, false, stream.NatsConfig(cfg.Events)) if err != nil { return err } @@ -87,7 +87,7 @@ func Server(cfg *config.Config) *cli.Command { svc, err := service.NewClientlogService( service.Logger(logger), service.Config(cfg), - service.Stream(stream), + service.Stream(s), service.GatewaySelector(gatewaySelector), service.RegisteredEvents(_registeredEvents), service.TraceProvider(tracerProvider), diff --git a/services/clientlog/pkg/logging/logging.go b/services/clientlog/pkg/logging/logging.go index 516b59246..ca7adb4cb 100644 --- a/services/clientlog/pkg/logging/logging.go +++ b/services/clientlog/pkg/logging/logging.go @@ -5,7 +5,7 @@ import ( "github.com/owncloud/ocis/v2/services/clientlog/pkg/config" ) -// LoggerFromConfig initializes a service-specific logger instance. +// Configure initializes a service-specific logger instance. func Configure(name string, cfg *config.Log) log.Logger { return log.NewLogger( log.Name(name), diff --git a/services/clientlog/pkg/service/service.go b/services/clientlog/pkg/service/service.go index 09933151b..1d037f3c1 100644 --- a/services/clientlog/pkg/service/service.go +++ b/services/clientlog/pkg/service/service.go @@ -80,11 +80,11 @@ func (cl *ClientlogService) Run() error { func (cl *ClientlogService) processEvent(event events.Event) { gwc, err := cl.gatewaySelector.Next() if err != nil { - cl.log.Error().Err(err).Interface("event", event).Msg("error getting gatway client") + cl.log.Error().Err(err).Interface("event", event).Msg("error getting gateway client") return } - ctx, err := utils.GetServiceUserContext(cl.cfg.ServiceAccount.ServiceAccountID, gwc, cl.cfg.ServiceAccount.ServiceAccountSecret) + ctx, err := utils.GetServiceUserContextWithContext(context.Background(), gwc, cl.cfg.ServiceAccount.ServiceAccountID, cl.cfg.ServiceAccount.ServiceAccountSecret) if err != nil { cl.log.Error().Err(err).Interface("event", event).Msg("error authenticating service user") return diff --git a/services/eventhistory/pkg/command/server.go b/services/eventhistory/pkg/command/server.go index 3a942b177..197e07ae8 100644 --- a/services/eventhistory/pkg/command/server.go +++ b/services/eventhistory/pkg/command/server.go @@ -53,12 +53,12 @@ func Server(cfg *config.Config) *cli.Command { } return context.WithCancel(cfg.Context) }() - metrics = metrics.New() + m = metrics.New() ) defer cancel() - metrics.BuildInfo.WithLabelValues(version.GetString()).Set(1) + m.BuildInfo.WithLabelValues(version.GetString()).Set(1) consumer, err := stream.NatsFromConfig(cfg.Service.Name, false, stream.NatsConfig(cfg.Events)) if err != nil { @@ -82,7 +82,7 @@ func Server(cfg *config.Config) *cli.Command { grpc.Name(cfg.Service.Name), grpc.Namespace(cfg.GRPC.Namespace), grpc.Address(cfg.GRPC.Addr), - grpc.Metrics(metrics), + grpc.Metrics(m), grpc.Consumer(consumer), grpc.Persistence(st), grpc.TraceProvider(traceProvider), diff --git a/services/eventhistory/pkg/logging/logging.go b/services/eventhistory/pkg/logging/logging.go index ec867698c..07c704fb0 100644 --- a/services/eventhistory/pkg/logging/logging.go +++ b/services/eventhistory/pkg/logging/logging.go @@ -5,7 +5,7 @@ import ( "github.com/owncloud/ocis/v2/services/eventhistory/pkg/config" ) -// LoggerFromConfig initializes a service-specific logger instance. +// Configure initializes a service-specific logger instance. func Configure(name string, cfg *config.Log) log.Logger { return log.NewLogger( log.Name(name), diff --git a/services/eventhistory/pkg/service/service.go b/services/eventhistory/pkg/service/service.go index 0c9bd723d..848fc4d9b 100644 --- a/services/eventhistory/pkg/service/service.go +++ b/services/eventhistory/pkg/service/service.go @@ -3,6 +3,7 @@ package service import ( "context" "encoding/json" + "errors" "fmt" "regexp" @@ -32,7 +33,7 @@ type EventHistoryService struct { // NewEventHistoryService returns an EventHistory service func NewEventHistoryService(cfg *config.Config, consumer events.Consumer, store store.Store, log log.Logger) (*EventHistoryService, error) { if consumer == nil || store == nil { - return nil, fmt.Errorf("Need non nil consumer (%v) and store (%v) to work properly", consumer, store) + return nil, fmt.Errorf("need non nil consumer (%v) and store (%v) to work properly", consumer, store) } ch, err := events.ConsumeAll(consumer, "evhistory") @@ -123,7 +124,7 @@ func (eh *EventHistoryService) GetEventsForUser(ctx context.Context, req *ehsvc. func (eh *EventHistoryService) getEvent(id string) (*ehmsg.Event, error) { evs, err := eh.store.Read(id) if err != nil { - if err != store.ErrNotFound { + if !errors.Is(err, store.ErrNotFound) { eh.log.Error().Err(err).Str("eventid", id).Msg("could not read event") } return nil, err diff --git a/services/eventhistory/pkg/service/service_test.go b/services/eventhistory/pkg/service/service_test.go index 882727317..84dc58a46 100644 --- a/services/eventhistory/pkg/service/service_test.go +++ b/services/eventhistory/pkg/service/service_test.go @@ -87,7 +87,7 @@ var _ = Describe("EventHistoryService", func() { Expect(resp).ToNot(BeNil()) // Events don't always come back in the same order as they were sent, so we need to sort them and - // do the same for the expcted IDs as well. + // do the same for the expected IDs as well. expectedIDs := []string{ids[0], ids[2]} sort.Strings(expectedIDs) var gotIDs []string diff --git a/services/frontend/pkg/command/events.go b/services/frontend/pkg/command/events.go index b3d39331c..b9012d42c 100644 --- a/services/frontend/pkg/command/events.go +++ b/services/frontend/pkg/command/events.go @@ -109,7 +109,7 @@ func AutoAcceptShares(ev events.ShareCreated, autoAcceptDefault bool, l log.Logg l.Error().Err(err).Msg("cannot get gateway client") return } - ctx, err := utils.GetServiceUserContext(cfg.ServiceAccountID, gwc, cfg.ServiceAccountSecret) + ctx, err := utils.GetServiceUserContextWithContext(context.Background(), gwc, cfg.ServiceAccountID, cfg.ServiceAccountSecret) if err != nil { l.Error().Err(err).Msg("cannot impersonate user") return @@ -137,9 +137,9 @@ func AutoAcceptShares(ev events.ShareCreated, autoAcceptDefault bool, l log.Logg continue } - mountpoint, err := getMountpoint(ctx, l, ev.ItemID, uid, gatewaySelector, info) + mp, err := getMountPoint(ctx, l, ev.ItemID, uid, gatewaySelector, info) if err != nil { - l.Error().Err(err).Msg("error getting mountpoint") + l.Error().Err(err).Msg("error getting mount point") continue } @@ -149,7 +149,7 @@ func AutoAcceptShares(ev events.ShareCreated, autoAcceptDefault bool, l log.Logg l.Error().Err(err).Msg("cannot get gateway client") continue } - resp, err := gwc.UpdateReceivedShare(ctx, updateShareRequest(ev.ShareID, uid, mountpoint)) + resp, err := gwc.UpdateReceivedShare(ctx, updateShareRequest(ev.ShareID, uid, mp)) if err != nil { l.Error().Err(err).Msg("error sending grpc request") continue @@ -162,7 +162,7 @@ func AutoAcceptShares(ev events.ShareCreated, autoAcceptDefault bool, l log.Logg } -func getMountpoint(ctx context.Context, l log.Logger, itemid *provider.ResourceId, uid *user.UserId, gatewaySelector pool.Selectable[gateway.GatewayAPIClient], info *provider.ResourceInfo) (string, error) { +func getMountPoint(ctx context.Context, l log.Logger, itemid *provider.ResourceId, uid *user.UserId, gatewaySelector pool.Selectable[gateway.GatewayAPIClient], info *provider.ResourceInfo) (string, error) { lrs, err := getSharesList(ctx, gatewaySelector, uid) if err != nil { return "", err diff --git a/services/frontend/pkg/config/config.go b/services/frontend/pkg/config/config.go index 9cae9ab91..dd1259659 100644 --- a/services/frontend/pkg/config/config.go +++ b/services/frontend/pkg/config/config.go @@ -30,12 +30,12 @@ type Config struct { MaxQuota uint64 `yaml:"max_quota" env:"OCIS_SPACES_MAX_QUOTA;FRONTEND_MAX_QUOTA" desc:"Set the global max quota value in bytes. A value of 0 equals unlimited. The value is provided via capabilities." introductionVersion:"pre5.0"` UploadMaxChunkSize int `yaml:"upload_max_chunk_size" env:"FRONTEND_UPLOAD_MAX_CHUNK_SIZE" desc:"Sets the max chunk sizes in bytes for uploads via the clients." introductionVersion:"pre5.0"` UploadHTTPMethodOverride string `yaml:"upload_http_method_override" env:"FRONTEND_UPLOAD_HTTP_METHOD_OVERRIDE" desc:"Advise TUS to replace PATCH requests by POST requests." introductionVersion:"pre5.0"` - DefaultUploadProtocol string `yaml:"default_upload_protocol" env:"FRONTEND_DEFAULT_UPLOAD_PROTOCOL" desc:"The default upload protocol to use in clients. Currently only 'tus' is avaliable. See the developer API documentation for more details about TUS." introductionVersion:"pre5.0"` - EnableResharing bool `yaml:"enable_resharing" env:"OCIS_ENABLE_RESHARING;FRONTEND_ENABLE_RESHARING" desc:"Changing this value is NOT supported. Enables the support for resharing in the clients." introductionVersion:"pre5.0" deprecationVersion:"5.0" deprecationInfo:"Resharing will be removed in the future."` + DefaultUploadProtocol string `yaml:"default_upload_protocol" env:"FRONTEND_DEFAULT_UPLOAD_PROTOCOL" desc:"The default upload protocol to use in clients. Currently only 'tus' is available. See the developer API documentation for more details about TUS." introductionVersion:"pre5.0"` + EnableResharing bool `yaml:"enable_resharing" env:"OCIS_ENABLE_RESHARING;FRONTEND_ENABLE_RESHARING" desc:"Changing this value is NOT supported. Enables the support for re-sharing in the clients." introductionVersion:"pre5.0" deprecationVersion:"5.0" deprecationInfo:"Re-sharing will be removed in the future."` EnableFederatedSharingIncoming bool `yaml:"enable_federated_sharing_incoming" env:"FRONTEND_ENABLE_FEDERATED_SHARING_INCOMING" desc:"Changing this value is NOT supported. Enables support for incoming federated sharing for clients. The backend behaviour is not changed." introductionVersion:"pre5.0"` EnableFederatedSharingOutgoing bool `yaml:"enable_federated_sharing_outgoing" env:"FRONTEND_ENABLE_FEDERATED_SHARING_OUTGOING" desc:"Changing this value is NOT supported. Enables support for outgoing federated sharing for clients. The backend behaviour is not changed." introductionVersion:"pre5.0"` SearchMinLength int `yaml:"search_min_length" env:"FRONTEND_SEARCH_MIN_LENGTH" desc:"Minimum number of characters to enter before a client should start a search for Share receivers. This setting can be used to customize the user experience if e.g too many results are displayed." introductionVersion:"pre5.0"` - Edition string `yaml:"edition" env:"OCIS_EDITION;FRONTEND_EDITION" desc:"Edition of oCIS. Used for branding pruposes." introductionVersion:"pre5.0"` + Edition string `yaml:"edition" env:"OCIS_EDITION;FRONTEND_EDITION" desc:"Edition of oCIS. Used for branding purposes." introductionVersion:"pre5.0"` DisableSSE bool `yaml:"disable_sse" env:"OCIS_DISABLE_SSE;FRONTEND_DISABLE_SSE" desc:"When set to true, clients are informed that the Server-Sent Events endpoint is not accessible." introductionVersion:"pre5.0"` DefaultLinkPermissions int `yaml:"default_link_permissions" env:"FRONTEND_DEFAULT_LINK_PERMISSIONS" desc:"Defines the default permissions a link is being created with. Possible values are 0 (= internal link, for instance members only) and 1 (= public link with viewer permissions). Defaults to 1." introductionVersion:"5.0"` @@ -126,7 +126,7 @@ type DataGateway struct { type OCS struct { Prefix string `yaml:"prefix" env:"FRONTEND_OCS_PREFIX" desc:"URL path prefix for the OCS service. Note that the string must not start with '/'." introductionVersion:"pre5.0"` SharePrefix string `yaml:"share_prefix" env:"FRONTEND_OCS_SHARE_PREFIX" desc:"Path prefix for shares as part of an ocis resource. Note that the path must start with '/'." introductionVersion:"pre5.0"` - HomeNamespace string `yaml:"home_namespace" env:"FRONTEND_OCS_PERSONAL_NAMESPACE" desc:"Homespace namespace identifier." introductionVersion:"pre5.0"` + HomeNamespace string `yaml:"home_namespace" env:"FRONTEND_OCS_PERSONAL_NAMESPACE" desc:"Home namespace identifier." introductionVersion:"pre5.0"` AdditionalInfoAttribute string `yaml:"additional_info_attribute" env:"FRONTEND_OCS_ADDITIONAL_INFO_ATTRIBUTE" desc:"Additional information attribute for the user like {{.Mail}}." introductionVersion:"pre5.0"` StatCacheType string `yaml:"stat_cache_type" env:"OCIS_CACHE_STORE;FRONTEND_OCS_STAT_CACHE_STORE" desc:"The type of the cache store. Supported values are: 'memory', 'redis-sentinel', 'nats-js-kv', 'noop'. See the text description for details." introductionVersion:"pre5.0"` StatCacheNodes []string `yaml:"stat_cache_nodes" env:"OCIS_CACHE_STORE_NODES;FRONTEND_OCS_STAT_CACHE_STORE_NODES" desc:"A list of nodes to access the configured store. This has no effect when 'memory' or 'ocmem' stores are configured. Note that the behaviour how nodes are used is dependent on the library of the configured store. See the Environment Variable Types description for more details." introductionVersion:"pre5.0"` diff --git a/services/frontend/pkg/logging/logging.go b/services/frontend/pkg/logging/logging.go index a1b6d6d44..ae1c806d1 100644 --- a/services/frontend/pkg/logging/logging.go +++ b/services/frontend/pkg/logging/logging.go @@ -5,7 +5,7 @@ import ( "github.com/owncloud/ocis/v2/services/frontend/pkg/config" ) -// LoggerFromConfig initializes a service-specific logger instance. +// Configure initializes a service-specific logger instance. func Configure(name string, cfg *config.Log) log.Logger { return log.NewLogger( log.Name(name), diff --git a/services/frontend/pkg/revaconfig/config.go b/services/frontend/pkg/revaconfig/config.go index 0b38abaab..f4d43ea23 100644 --- a/services/frontend/pkg/revaconfig/config.go +++ b/services/frontend/pkg/revaconfig/config.go @@ -116,9 +116,9 @@ func FrontendConfigFromStruct(cfg *config.Config, logger log.Logger) (map[string "services": map[string]interface{}{ // this reva service called "appprovider" comes from // `internal/http/services/appprovider` and is a translation - // layer from the grpc app registry to http, used by eg. ownCloud Web + // layer from the grpc app registry to http, used by e.g. ownCloud Web // It should not be confused with `internal/grpc/services/appprovider` - // which is currently only has only the driver for the CS3org WOPI server + // which is currently only the driver for the CS3org WOPI server "appprovider": map[string]interface{}{ "prefix": cfg.AppHandler.Prefix, "transfer_shared_secret": cfg.TransferSecret, diff --git a/services/frontend/pkg/server/debug/server.go b/services/frontend/pkg/server/debug/server.go index 84dfc1c71..4c813dc4f 100644 --- a/services/frontend/pkg/server/debug/server.go +++ b/services/frontend/pkg/server/debug/server.go @@ -39,7 +39,7 @@ func health(cfg *config.Config) func(http.ResponseWriter, *http.Request) { // TODO: check if services are up and running _, err := io.WriteString(w, http.StatusText(http.StatusOK)) - // io.WriteString should not fail but if it does we want to know. + // io.WriteString should not fail but if it does, we want to know. if err != nil { panic(err) } @@ -55,7 +55,7 @@ func ready(cfg *config.Config) func(http.ResponseWriter, *http.Request) { // TODO: check if services are up and running _, err := io.WriteString(w, http.StatusText(http.StatusOK)) - // io.WriteString should not fail but if it does we want to know. + // io.WriteString should not fail but if it does, we want to know. if err != nil { panic(err) } diff --git a/services/gateway/pkg/config/config.go b/services/gateway/pkg/config/config.go index cc7fc2479..73b932de7 100644 --- a/services/gateway/pkg/config/config.go +++ b/services/gateway/pkg/config/config.go @@ -89,7 +89,7 @@ type Cache struct { ProviderCacheNodes []string `yaml:"provider_cache_nodes" env:"OCIS_CACHE_STORE_NODES;GATEWAY_PROVIDER_CACHE_STORE_NODES" desc:"A list of nodes to access the configured store. This has no effect when 'memory' or 'ocmem' stores are configured. Note that the behaviour how nodes are used is dependent on the library of the configured store. See the Environment Variable Types description for more details." introductionVersion:"pre5.0"` ProviderCacheDatabase string `yaml:"provider_cache_database" env:"OCIS_CACHE_DATABASE" desc:"The database name the configured store should use." introductionVersion:"pre5.0"` ProviderCacheTTL time.Duration `yaml:"provider_cache_ttl" env:"OCIS_CACHE_TTL;GATEWAY_PROVIDER_CACHE_TTL" desc:"Default time to live for user info in the cache. Only applied when access tokens has no expiration. See the Environment Variable Types description for more details." introductionVersion:"pre5.0"` - ProviderCacheSize int `yaml:"provider_cache_size" env:"OCIS_CACHE_SIZE;GATEWAY_PROVIDER_CACHE_SIZE" desc:"The maximum quantity of items in the cache. Only applies when store type 'ocmem' is configured. Defaults to 512 which is derived from the ocmem package though not exclicitely set as default." introductionVersion:"pre5.0"` + ProviderCacheSize int `yaml:"provider_cache_size" env:"OCIS_CACHE_SIZE;GATEWAY_PROVIDER_CACHE_SIZE" desc:"The maximum quantity of items in the cache. Only applies when store type 'ocmem' is configured. Defaults to 512 which is derived from the ocmem package though not explicitly set as default." introductionVersion:"pre5.0"` ProviderCacheDisablePersistence bool `yaml:"provider_cache_disable_persistence" env:"OCIS_CACHE_DISABLE_PERSISTENCE;GATEWAY_PROVIDER_CACHE_DISABLE_PERSISTENCE" desc:"Disables persistence of the provider cache. Only applies when store type 'nats-js-kv' is configured. Defaults to false." introductionVersion:"5.0"` ProviderCacheAuthUsername string `yaml:"provider_cache_auth_username" env:"OCIS_CACHE_AUTH_USERNAME;GATEWAY_PROVIDER_CACHE_AUTH_USERNAME" desc:"The username to use for authentication. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"` ProviderCacheAuthPassword string `yaml:"provider_cache_auth_password" env:"OCIS_CACHE_AUTH_PASSWORD;GATEWAY_PROVIDER_CACHE_AUTH_PASSWORD" desc:"The password to use for authentication. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"` @@ -97,7 +97,7 @@ type Cache struct { CreateHomeCacheNodes []string `yaml:"create_home_cache_nodes" env:"OCIS_CACHE_STORE_NODES;GATEWAY_CREATE_HOME_CACHE_STORE_NODES" desc:"A list of nodes to access the configured store. This has no effect when 'memory' or 'ocmem' stores are configured. Note that the behaviour how nodes are used is dependent on the library of the configured store. See the Environment Variable Types description for more details." introductionVersion:"pre5.0"` CreateHomeCacheDatabase string `yaml:"create_home_cache_database" env:"OCIS_CACHE_DATABASE" desc:"The database name the configured store should use." introductionVersion:"pre5.0"` CreateHomeCacheTTL time.Duration `yaml:"create_home_cache_ttl" env:"OCIS_CACHE_TTL;GATEWAY_CREATE_HOME_CACHE_TTL" desc:"Default time to live for user info in the cache. Only applied when access tokens has no expiration. See the Environment Variable Types description for more details." introductionVersion:"pre5.0"` - CreateHomeCacheSize int `yaml:"create_home_cache_size" env:"OCIS_CACHE_SIZE;GATEWAY_CREATE_HOME_CACHE_SIZE" desc:"The maximum quantity of items in the cache. Only applies when store type 'ocmem' is configured. Defaults to 512 which is derived from the ocmem package though not exclicitely set as default." introductionVersion:"pre5.0"` + CreateHomeCacheSize int `yaml:"create_home_cache_size" env:"OCIS_CACHE_SIZE;GATEWAY_CREATE_HOME_CACHE_SIZE" desc:"The maximum quantity of items in the cache. Only applies when store type 'ocmem' is configured. Defaults to 512 which is derived from the ocmem package though not explicitly set as default." introductionVersion:"pre5.0"` CreateHomeCacheDisablePersistence bool `yaml:"create_home_cache_disable_persistence" env:"OCIS_CACHE_DISABLE_PERSISTENCE;GATEWAY_CREATE_HOME_CACHE_DISABLE_PERSISTENCE" desc:"Disables persistence of the create home cache. Only applies when store type 'nats-js-kv' is configured. Defaults to false." introductionVersion:"5.0"` CreateHomeCacheAuthUsername string `yaml:"create_home_cache_auth_username" env:"OCIS_CACHE_AUTH_USERNAME;GATEWAY_CREATE_HOME_CACHE_AUTH_USERNAME" desc:"The username to use for authentication. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"` CreateHomeCacheAuthPassword string `yaml:"create_home_cache_auth_password" env:"OCIS_CACHE_AUTH_PASSWORD;GATEWAY_CREATE_HOME_CACHE_AUTH_PASSWORD" desc:"The password to use for authentication. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"` diff --git a/services/gateway/pkg/logging/logging.go b/services/gateway/pkg/logging/logging.go index 20e57dfb5..2f6971e59 100644 --- a/services/gateway/pkg/logging/logging.go +++ b/services/gateway/pkg/logging/logging.go @@ -5,7 +5,7 @@ import ( "github.com/owncloud/ocis/v2/services/gateway/pkg/config" ) -// LoggerFromConfig initializes a service-specific logger instance. +// Configure initializes a service-specific logger instance. func Configure(name string, cfg *config.Log) log.Logger { return log.NewLogger( log.Name(name), diff --git a/services/gateway/pkg/revaconfig/config.go b/services/gateway/pkg/revaconfig/config.go index c13688aee..055b4b5d3 100644 --- a/services/gateway/pkg/revaconfig/config.go +++ b/services/gateway/pkg/revaconfig/config.go @@ -37,7 +37,7 @@ func GatewayConfigFromStruct(cfg *config.Config, logger log.Logger) map[string]i // TODO build services dynamically "services": map[string]interface{}{ "gateway": map[string]interface{}{ - // registries is located on the gateway + // registries are located on the gateway "authregistrysvc": cfg.Reva.Address, "storageregistrysvc": cfg.Reva.Address, "appregistrysvc": cfg.AppRegistryEndpoint, diff --git a/services/gateway/pkg/server/debug/server.go b/services/gateway/pkg/server/debug/server.go index 4f2e20c60..18ad6b6f4 100644 --- a/services/gateway/pkg/server/debug/server.go +++ b/services/gateway/pkg/server/debug/server.go @@ -39,7 +39,7 @@ func health(cfg *config.Config) func(http.ResponseWriter, *http.Request) { // TODO: check if services are up and running _, err := io.WriteString(w, http.StatusText(http.StatusOK)) - // io.WriteString should not fail but if it does we want to know. + // io.WriteString should not fail but if it does, we want to know. if err != nil { panic(err) } @@ -55,7 +55,7 @@ func ready(cfg *config.Config) func(http.ResponseWriter, *http.Request) { // TODO: check if services are up and running _, err := io.WriteString(w, http.StatusText(http.StatusOK)) - // io.WriteString should not fail but if it does we want to know. + // io.WriteString should not fail but if it does, we want to know. if err != nil { panic(err) } diff --git a/services/graph/pkg/config/cache.go b/services/graph/pkg/config/cache.go index 725f26a33..a8c25667f 100644 --- a/services/graph/pkg/config/cache.go +++ b/services/graph/pkg/config/cache.go @@ -9,7 +9,7 @@ type Cache struct { Database string `yaml:"database" env:"GRAPH_CACHE_STORE_DATABASE" desc:"The database name the configured store should use." introductionVersion:"pre5.0"` Table string `yaml:"table" env:"GRAPH_CACHE_STORE_TABLE" desc:"The database table the store should use." introductionVersion:"pre5.0"` TTL time.Duration `yaml:"ttl" env:"OCIS_CACHE_TTL;GRAPH_CACHE_TTL" desc:"Time to live for cache records in the graph. Defaults to '336h' (2 weeks). See the Environment Variable Types description for more details." introductionVersion:"pre5.0"` - Size int `yaml:"size" env:"OCIS_CACHE_SIZE;GRAPH_CACHE_SIZE" desc:"The maximum quantity of items in the store. Only applies when store type 'ocmem' is configured. Defaults to 512 which is derived from the ocmem package though not exclicitely set as default." introductionVersion:"pre5.0"` + Size int `yaml:"size" env:"OCIS_CACHE_SIZE;GRAPH_CACHE_SIZE" desc:"The maximum quantity of items in the store. Only applies when store type 'ocmem' is configured. Defaults to 512 which is derived from the ocmem package though not explicitly set as default." introductionVersion:"pre5.0"` DisablePersistence bool `yaml:"disable_persistence" env:"OCIS_CACHE_DISABLE_PERSISTENCE;GRAPH_CACHE_DISABLE_PERSISTENCE" desc:"Disables persistence of the cache. Only applies when store type 'nats-js-kv' is configured. Defaults to false." introductionVersion:"5.0"` AuthUsername string `yaml:"username" env:"OCIS_CACHE_AUTH_USERNAME;GRAPH_CACHE_AUTH_USERNAME" desc:"The username to authenticate with the cache. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"` AuthPassword string `yaml:"password" env:"OCIS_CACHE_AUTH_PASSWORD;GRAPH_CACHE_AUTH_PASSWORD" desc:"The password to authenticate with the cache. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"` diff --git a/services/graph/pkg/config/config.go b/services/graph/pkg/config/config.go index 2aeb1a8ab..ed2133483 100644 --- a/services/graph/pkg/config/config.go +++ b/services/graph/pkg/config/config.go @@ -40,7 +40,7 @@ type Config struct { type Spaces struct { WebDavBase string `yaml:"webdav_base" env:"OCIS_URL;GRAPH_SPACES_WEBDAV_BASE" desc:"The public facing URL of WebDAV." introductionVersion:"pre5.0"` - WebDavPath string `yaml:"webdav_path" env:"GRAPH_SPACES_WEBDAV_PATH" desc:"The WebDAV subpath for spaces." introductionVersion:"pre5.0"` + WebDavPath string `yaml:"webdav_path" env:"GRAPH_SPACES_WEBDAV_PATH" desc:"The WebDAV sub-path for spaces." introductionVersion:"pre5.0"` DefaultQuota string `yaml:"default_quota" env:"GRAPH_SPACES_DEFAULT_QUOTA" desc:"The default quota in bytes." introductionVersion:"pre5.0"` ExtendedSpacePropertiesCacheTTL int `yaml:"extended_space_properties_cache_ttl" env:"GRAPH_SPACES_EXTENDED_SPACE_PROPERTIES_CACHE_TTL" desc:"Max TTL in seconds for the spaces property cache." introductionVersion:"pre5.0"` UsersCacheTTL int `yaml:"users_cache_ttl" env:"GRAPH_SPACES_USERS_CACHE_TTL" desc:"Max TTL in seconds for the spaces users cache." introductionVersion:"pre5.0"` @@ -65,7 +65,7 @@ type LDAP struct { UserFilter string `yaml:"user_filter" env:"OCIS_LDAP_USER_FILTER;GRAPH_LDAP_USER_FILTER" desc:"LDAP filter to add to the default filters for user search like '(objectclass=ownCloud)'." introductionVersion:"pre5.0"` UserObjectClass string `yaml:"user_objectclass" env:"OCIS_LDAP_USER_OBJECTCLASS;GRAPH_LDAP_USER_OBJECTCLASS" desc:"The object class to use for users in the default user search filter ('inetOrgPerson')." introductionVersion:"pre5.0"` UserEmailAttribute string `yaml:"user_mail_attribute" env:"OCIS_LDAP_USER_SCHEMA_MAIL;GRAPH_LDAP_USER_EMAIL_ATTRIBUTE" desc:"LDAP Attribute to use for the email address of users." introductionVersion:"pre5.0"` - UserDisplayNameAttribute string `yaml:"user_displayname_attribute" env:"LDAP_USER_SCHEMA_DISPLAY_NAME;GRAPH_LDAP_USER_DISPLAYNAME_ATTRIBUTE" desc:"LDAP Attribute to use for the displayname of users." introductionVersion:"pre5.0"` + UserDisplayNameAttribute string `yaml:"user_displayname_attribute" env:"LDAP_USER_SCHEMA_DISPLAY_NAME;GRAPH_LDAP_USER_DISPLAYNAME_ATTRIBUTE" desc:"LDAP Attribute to use for the display name of users." introductionVersion:"pre5.0"` UserNameAttribute string `yaml:"user_name_attribute" env:"OCIS_LDAP_USER_SCHEMA_USERNAME;GRAPH_LDAP_USER_NAME_ATTRIBUTE" desc:"LDAP Attribute to use for username of users." introductionVersion:"pre5.0"` UserIDAttribute string `yaml:"user_id_attribute" env:"OCIS_LDAP_USER_SCHEMA_ID;GRAPH_LDAP_USER_UID_ATTRIBUTE" desc:"LDAP Attribute to use as the unique ID for users. This should be a stable globally unique ID like a UUID." introductionVersion:"pre5.0"` UserIDIsOctetString bool `yaml:"user_id_is_octet_string" env:"OCIS_LDAP_USER_SCHEMA_ID_IS_OCTETSTRING;GRAPH_LDAP_USER_SCHEMA_ID_IS_OCTETSTRING" desc:"Set this to true if the defined 'ID' attribute for users is of the 'OCTETSTRING' syntax. This is required when using the 'objectGUID' attribute of Active Directory for the user ID's." introductionVersion:"pre5.0"` @@ -154,5 +154,5 @@ type ServiceAccount struct { // FilesSharing is the configuration for the files sharing type FilesSharing struct { - EnableResharing bool `yaml:"enable_resharing" env:"OCIS_ENABLE_RESHARING;GRAPH_ENABLE_RESHARING" desc:"Changing this value is NOT supported. Enables the support for resharing." introductionVersion:"5.0" deprecationVersion:"5.0" deprecationInfo:"Resharing will be removed in the future."` + EnableResharing bool `yaml:"enable_resharing" env:"OCIS_ENABLE_RESHARING;GRAPH_ENABLE_RESHARING" desc:"Changing this value is NOT supported. Enables the support for re-sharing." introductionVersion:"5.0" deprecationVersion:"5.0" deprecationInfo:"Resharing will be removed in the future."` } diff --git a/services/graph/pkg/errorcode/cs3_test.go b/services/graph/pkg/errorcode/cs3_test.go index 13184531e..f4a1f60a1 100644 --- a/services/graph/pkg/errorcode/cs3_test.go +++ b/services/graph/pkg/errorcode/cs3_test.go @@ -46,7 +46,7 @@ func TestFromCS3Status(t *testing.T) { for _, test := range tests { if output := errorcode.FromCS3Status(test.status, test.err, test.ignore...); !reflect.DeepEqual(output, test.result) { - t.Error("Test Failed: {} expected, recieved: {}", test.result, output) + t.Error("Test Failed: {} expected, received: {}", test.result, output) } } } @@ -63,7 +63,7 @@ func TestFromStat(t *testing.T) { for _, test := range tests { if output := errorcode.FromStat(test.stat, test.err); !reflect.DeepEqual(output, test.result) { - t.Error("Test Failed: {} expected, recieved: {}", test.result, output) + t.Error("Test Failed: {} expected, received: {}", test.result, output) } } } diff --git a/services/graph/pkg/errorcode/errorcode.go b/services/graph/pkg/errorcode/errorcode.go index 14db1bb0a..88bb421f2 100644 --- a/services/graph/pkg/errorcode/errorcode.go +++ b/services/graph/pkg/errorcode/errorcode.go @@ -15,7 +15,7 @@ import ( // ErrorCode defines code as used in MS Graph - see https://docs.microsoft.com/en-us/graph/errors?context=graph%2Fapi%2F1.0&view=graph-rest-1.0 type ErrorCode int -// Error defines a custom error struct, containing and MS Graph error code an a textual error message +// Error defines a custom error struct, containing and MS Graph error code and a textual error message type Error struct { errorCode ErrorCode msg string @@ -51,7 +51,7 @@ const ( ResyncRequired // ServiceNotAvailable defines the error if the service is not available. Try the request again after a delay. There may be a Retry-After header. ServiceNotAvailable - // The sync state generation is not found. The delta token is expired and data must be synchronized again. + // SyncStateNotFound defines the error when the sync state generation is not found. The delta token is expired and data must be synchronized again. SyncStateNotFound // QuotaLimitReached the user has reached their quota limit. QuotaLimitReached @@ -93,7 +93,7 @@ func New(e ErrorCode, msg string) Error { } } -// Render writes an Graph ErrorCode object to the response writer +// Render writes a Graph ErrorCode object to the response writer func (e ErrorCode) Render(w http.ResponseWriter, r *http.Request, status int, msg string) { render.Status(r, status) render.JSON(w, r, e.CreateOdataError(r.Context(), msg)) @@ -115,7 +115,7 @@ func (e ErrorCode) CreateOdataError(ctx context.Context, msg string) *libregraph } } -// Render writes an Graph Error object to the response writer +// Render writes a Graph Error object to the response writer func (e Error) Render(w http.ResponseWriter, r *http.Request) { var status int switch e.errorCode { @@ -148,7 +148,7 @@ func (e ErrorCode) String() string { return errorCodes[e] } -// Error return the concatenation of the error string and optinal message +// Error return the concatenation of the error string and optional message func (e Error) Error() string { errString := errorCodes[e.errorCode] if e.msg != "" { diff --git a/services/graph/pkg/identity/backend.go b/services/graph/pkg/identity/backend.go index 08afc0d4f..99a38574c 100644 --- a/services/graph/pkg/identity/backend.go +++ b/services/graph/pkg/identity/backend.go @@ -50,7 +50,7 @@ type Backend interface { type EducationBackend interface { // CreateEducationSchool creates the supplied school in the identity backend. CreateEducationSchool(ctx context.Context, group libregraph.EducationSchool) (*libregraph.EducationSchool, error) - // DeleteSchool deletes a given school, identified by id + // DeleteEducationSchool deletes a given school, identified by id DeleteEducationSchool(ctx context.Context, id string) error // GetEducationSchool reads a given school by id GetEducationSchool(ctx context.Context, nameOrID string) (*libregraph.EducationSchool, error) @@ -65,7 +65,7 @@ type EducationBackend interface { // RemoveUserFromEducationSchool removes a single member (by ID) from a school RemoveUserFromEducationSchool(ctx context.Context, schoolID string, memberID string) error - // GetEducationSchoolClasses lists all classes in a chool + // GetEducationSchoolClasses lists all classes in a school GetEducationSchoolClasses(ctx context.Context, schoolNumberOrID string) ([]*libregraph.EducationClass, error) // AddClassesToEducationSchool adds new classes (referenced by a slice of IDs) to supplied school in the identity backend. AddClassesToEducationSchool(ctx context.Context, schoolNumberOrID string, memberIDs []string) error @@ -74,7 +74,7 @@ type EducationBackend interface { // GetEducationClasses lists all classes GetEducationClasses(ctx context.Context) ([]*libregraph.EducationClass, error) - // GetEducationClasses reads a given class by id + // GetEducationClass reads a given class by id GetEducationClass(ctx context.Context, namedOrID string) (*libregraph.EducationClass, error) // CreateEducationClass creates the supplied education class in the identity backend. CreateEducationClass(ctx context.Context, class libregraph.EducationClass) (*libregraph.EducationClass, error) @@ -87,7 +87,7 @@ type EducationBackend interface { // CreateEducationUser creates a given education user in the identity backend. CreateEducationUser(ctx context.Context, user libregraph.EducationUser) (*libregraph.EducationUser, error) - // DeleteEducationUser deletes a given educationuser, identified by username or id, from the backend + // DeleteEducationUser deletes a given education user, identified by username or id, from the backend DeleteEducationUser(ctx context.Context, nameOrID string) error // UpdateEducationUser applies changes to given education user, identified by username or id UpdateEducationUser(ctx context.Context, nameOrID string, user libregraph.EducationUser) (*libregraph.EducationUser, error) @@ -98,7 +98,7 @@ type EducationBackend interface { // GetEducationClassTeachers returns the EducationUser teachers for an EducationClass GetEducationClassTeachers(ctx context.Context, classID string) ([]*libregraph.EducationUser, error) - // AddTeacherToEducationclass adds a teacher (by ID) to class in the identity backend. + // AddTeacherToEducationClass adds a teacher (by ID) to class in the identity backend. AddTeacherToEducationClass(ctx context.Context, classID string, teacherID string) error // RemoveTeacherFromEducationClass removes teacher (by ID) from a class RemoveTeacherFromEducationClass(ctx context.Context, classID string, teacherID string) error diff --git a/services/graph/pkg/identity/cache.go b/services/graph/pkg/identity/cache.go index f394b040c..57d835b08 100644 --- a/services/graph/pkg/identity/cache.go +++ b/services/graph/pkg/identity/cache.go @@ -28,7 +28,7 @@ type identityCacheOptions struct { groupsTTL time.Duration } -// IdentityCacheOptiondefines a single option function. +// IdentityCacheOption defines a single option function. type IdentityCacheOption func(o *identityCacheOptions) // IdentityCacheWithGatewaySelector set the gatewaySelector for the Identity Cache @@ -60,7 +60,7 @@ func newOptions(opts ...IdentityCacheOption) identityCacheOptions { return opt } -// NewIdentityCache instanciates a new IdentityCache and sets the supplied options +// NewIdentityCache instantiates a new IdentityCache and sets the supplied options func NewIdentityCache(opts ...IdentityCacheOption) IdentityCache { opt := newOptions(opts...) @@ -83,7 +83,7 @@ func NewIdentityCache(opts ...IdentityCacheOption) IdentityCache { return cache } -// GetUser looks up a user by id, if the user is not cached yet it will do a lookup via the CS3 API +// GetUser looks up a user by id, if the user is not cached, yet it will do a lookup via the CS3 API func (cache IdentityCache) GetUser(ctx context.Context, userid string) (libregraph.User, error) { var user libregraph.User if item := cache.users.Get(userid); item == nil { @@ -91,14 +91,14 @@ func (cache IdentityCache) GetUser(ctx context.Context, userid string) (libregra cs3UserID := &cs3User.UserId{ OpaqueId: userid, } - cs3User, err := revautils.GetUser(cs3UserID, gatewayClient) + u, err := revautils.GetUserWithContext(ctx, cs3UserID, gatewayClient) if err != nil { if revautils.IsErrNotFound(err) { return libregraph.User{}, ErrNotFound } return libregraph.User{}, errorcode.New(errorcode.GeneralException, err.Error()) } - user = *CreateUserModelFromCS3(cs3User) + user = *CreateUserModelFromCS3(u) cache.users.Set(userid, user, ttlcache.DefaultTTL) } else { @@ -107,13 +107,13 @@ func (cache IdentityCache) GetUser(ctx context.Context, userid string) (libregra return user, nil } -// GetUser looks up a group by id, if the group is not cached yet it will do a lookup via the CS3 API -func (cache IdentityCache) GetGroup(ctx context.Context, groupid string) (libregraph.Group, error) { +// GetGroup looks up a group by id, if the group is not cached, yet it will do a lookup via the CS3 API +func (cache IdentityCache) GetGroup(ctx context.Context, groupID string) (libregraph.Group, error) { var group libregraph.Group - if item := cache.groups.Get(groupid); item == nil { + if item := cache.groups.Get(groupID); item == nil { gatewayClient, err := cache.gatewaySelector.Next() cs3GroupID := &cs3Group.GroupId{ - OpaqueId: groupid, + OpaqueId: groupID, } req := cs3Group.GetGroupRequest{ GroupId: cs3GroupID, @@ -124,9 +124,9 @@ func (cache IdentityCache) GetGroup(ctx context.Context, groupid string) (libreg } switch res.Status.Code { case rpc.Code_CODE_OK: - cs3Group := res.GetGroup() - group = *CreateGroupModelFromCS3(cs3Group) - cache.groups.Set(groupid, group, ttlcache.DefaultTTL) + g := res.GetGroup() + group = *CreateGroupModelFromCS3(g) + cache.groups.Set(groupID, group, ttlcache.DefaultTTL) case rpc.Code_CODE_NOT_FOUND: return group, ErrNotFound default: diff --git a/services/graph/pkg/identity/cs3.go b/services/graph/pkg/identity/cs3.go index b704ae312..1b1e3eaa0 100644 --- a/services/graph/pkg/identity/cs3.go +++ b/services/graph/pkg/identity/cs3.go @@ -36,7 +36,7 @@ func (i *CS3) DeleteUser(ctx context.Context, nameOrID string) error { return errNotImplemented } -// UpdateUser implements the Backend Interface. It's currently not suported for the CS3 backend +// UpdateUser implements the Backend Interface. It's currently not supported for the CS3 backend func (i *CS3) UpdateUser(ctx context.Context, nameOrID string, user libregraph.User) (*libregraph.User, error) { return nil, errNotImplemented } diff --git a/services/graph/pkg/identity/err_education.go b/services/graph/pkg/identity/err_education.go index b1ed28da0..f455bf83a 100644 --- a/services/graph/pkg/identity/err_education.go +++ b/services/graph/pkg/identity/err_education.go @@ -89,7 +89,7 @@ func (i *ErrEducationBackend) GetEducationClassMembers(ctx context.Context, name return nil, errNotImplemented } -// UpdateEducationClass implments the EducationBackend interface +// UpdateEducationClass implements the EducationBackend interface func (i *ErrEducationBackend) UpdateEducationClass(ctx context.Context, id string, class libregraph.EducationClass) (*libregraph.EducationClass, error) { return nil, errNotImplemented } @@ -99,7 +99,7 @@ func (i *ErrEducationBackend) CreateEducationUser(ctx context.Context, user libr return nil, errNotImplemented } -// DeleteEducationUser deletes a given educationuser, identified by username or id, from the backend +// DeleteEducationUser deletes a given education user, identified by username or id, from the backend func (i *ErrEducationBackend) DeleteEducationUser(ctx context.Context, nameOrID string) error { return errNotImplemented } diff --git a/services/graph/pkg/identity/ldap.go b/services/graph/pkg/identity/ldap.go index 4362560c5..efa2fd793 100644 --- a/services/graph/pkg/identity/ldap.go +++ b/services/graph/pkg/identity/ldap.go @@ -203,7 +203,7 @@ func (i *LDAP) CreateUser(ctx context.Context, user libregraph.User) (*libregrap } if i.usePwModifyExOp && user.PasswordProfile != nil && user.PasswordProfile.Password != nil { - if err := i.updateUserPassowrd(ctx, ar.DN, user.PasswordProfile.GetPassword()); err != nil { + if err := i.updateUserPassword(ctx, ar.DN, user.PasswordProfile.GetPassword()); err != nil { return nil, err } } @@ -265,7 +265,7 @@ func (i *LDAP) UpdateUser(ctx context.Context, nameOrID string, user libregraph. logger := i.logger.SubloggerWithRequestID(ctx) logger.Debug().Str("backend", "ldap").Msg("UpdateUser") if !i.writeEnabled { - // still allow eanble/disable User when using DisableMechanismGroup + // still allow to enable/disable user when using DisableMechanismGroup if i.disableUserMechanism == DisableMechanismGroup && isUserEnabledUpdate(user) { logger.Error().Str("backend", "ldap").Msg("Allowing accountEnabled Update on read-only backend") } else { @@ -319,7 +319,7 @@ func (i *LDAP) UpdateUser(ctx context.Context, nameOrID string, user libregraph. if user.PasswordProfile != nil && user.PasswordProfile.GetPassword() != "" { if i.usePwModifyExOp { - if err := i.updateUserPassowrd(ctx, e.DN, user.PasswordProfile.GetPassword()); err != nil { + if err := i.updateUserPassword(ctx, e.DN, user.PasswordProfile.GetPassword()); err != nil { msg := "error updating user password" logger.Error().Err(err).Msg(msg) errMap := ldapResultToErrMap{ @@ -376,7 +376,7 @@ func (i *LDAP) UpdateUser(ctx context.Context, nameOrID string, user libregraph. returnUser := i.createUserModelFromLDAP(e) - // To avoid an ldap lookup for group membership, set the enabled flag to same as input value + // To avoid a ldap lookup for group membership, set the enabled flag to same as input value // since this would have been updated with group membership from the input anyway. if user.AccountEnabled != nil && i.disableUserMechanism == DisableMechanismGroup { returnUser.AccountEnabled = user.AccountEnabled @@ -490,7 +490,7 @@ func filterEscapeUUID(binary bool, id string) (string, error) { func (i *LDAP) getLDAPUserByID(id string) (*ldap.Entry, error) { idString, err := filterEscapeUUID(i.userIDisOctetString, id) if err != nil { - return nil, fmt.Errorf("Invalid User id: %w", err) + return nil, fmt.Errorf("invalid User id: %w", err) } filter := fmt.Sprintf("(%s=%s)", i.userAttributeMap.id, idString) return i.getLDAPUserByFilter(filter) @@ -498,7 +498,7 @@ func (i *LDAP) getLDAPUserByID(id string) (*ldap.Entry, error) { func (i *LDAP) getLDAPUserByNameOrID(nameOrID string) (*ldap.Entry, error) { idString, err := filterEscapeUUID(i.userIDisOctetString, nameOrID) - // err != nil just means that this is not a uuid so we can skip the uuid filterpart + // err != nil just means that this is not an uuid, so we can skip the uuid filter part // and just filter by name filter := "" if err == nil { @@ -738,9 +738,9 @@ func (i *LDAP) renameMemberInGroup(ctx context.Context, group *ldap.Entry, oldMe return nil } -func (i *LDAP) updateUserPassowrd(ctx context.Context, dn, password string) error { +func (i *LDAP) updateUserPassword(ctx context.Context, dn, password string) error { logger := i.logger.SubloggerWithRequestID(ctx) - logger.Debug().Str("backend", "ldap").Msg("updateUserPassowrd") + logger.Debug().Str("backend", "ldap").Msg("updateUserPassword") pwMod := ldap.PasswordModifyRequest{ UserIdentity: dn, NewPassword: password, @@ -915,7 +915,7 @@ func stringToScope(scope string) (int, error) { return s, nil } -// removeEntryByDNAndAttributeFromEntry creates a request to remove a single member entry by attribute and DN from an ldap entry +// removeEntryByDNAndAttributeFromEntry creates a request to remove a single member entry by attribute and DN from a ldap entry func (i *LDAP) removeEntryByDNAndAttributeFromEntry(entry *ldap.Entry, dn string, attribute string) error { nOldDN, err := ldapdn.ParseNormalize(dn) if err != nil { @@ -982,7 +982,7 @@ func (i *LDAP) removeEntryByDNAndAttributeFromEntry(entry *ldap.Entry, dn string return nil } -// expandLDAPAttributeEntries reads an attribute from an ldap entry and expands to users +// expandLDAPAttributeEntries reads an attribute from a ldap entry and expands to users func (i *LDAP) expandLDAPAttributeEntries(ctx context.Context, e *ldap.Entry, attribute string) ([]*ldap.Entry, error) { logger := i.logger.SubloggerWithRequestID(ctx) logger.Debug().Str("backend", "ldap").Msg("ExpandLDAPAttributeEntries") @@ -1007,7 +1007,7 @@ func (i *LDAP) expandLDAPAttributeEntries(ctx context.Context, e *ldap.Entry, at func replaceDN(fullDN *ldap.DN, newDN string) (string, error) { if len(fullDN.RDNs) == 0 { - return "", fmt.Errorf("Can't operate on an empty dn") + return "", fmt.Errorf("can't operate on an empty dn") } if len(fullDN.RDNs) == 1 { diff --git a/services/graph/pkg/identity/ldap/reconnect.go b/services/graph/pkg/identity/ldap/reconnect.go index 263353bc1..d33fc13d7 100644 --- a/services/graph/pkg/identity/ldap/reconnect.go +++ b/services/graph/pkg/identity/ldap/reconnect.go @@ -24,7 +24,7 @@ type ldapConnection struct { Error error } -// Implements the ldap.CLient interface +// ConnWithReconnect implements the ldap.Client interface type ConnWithReconnect struct { conn chan ldapConnection reset chan *ldap.Conn diff --git a/services/graph/pkg/identity/ldap_education_class.go b/services/graph/pkg/identity/ldap_education_class.go index daba2f9f1..80ef605bc 100644 --- a/services/graph/pkg/identity/ldap_education_class.go +++ b/services/graph/pkg/identity/ldap_education_class.go @@ -66,7 +66,7 @@ func (i *LDAP) GetEducationClasses(ctx context.Context) ([]*libregraph.Education // CreateEducationClass implements the EducationBackend interface for the LDAP backend. // An EducationClass is mapped to an LDAP entry of the "groupOfNames" structural ObjectClass. -// With a few additional Attributes added on top via the "ocEducationClass" auxiallary ObjectClass. +// With a few additional Attributes added on top via the "ocEducationClass" auxiliary ObjectClass. func (i *LDAP) CreateEducationClass(ctx context.Context, class libregraph.EducationClass) (*libregraph.EducationClass, error) { logger := i.logger.SubloggerWithRequestID(ctx) logger.Debug().Str("backend", "ldap").Msg("create educationClass") diff --git a/services/graph/pkg/identity/ldap_education_class_test.go b/services/graph/pkg/identity/ldap_education_class_test.go index f579b0b41..2b9cc199a 100644 --- a/services/graph/pkg/identity/ldap_education_class_test.go +++ b/services/graph/pkg/identity/ldap_education_class_test.go @@ -56,15 +56,15 @@ func TestCreateEducationClass(t *testing.T) { class := libregraph.NewEducationClass("Math", "course") class.SetExternalId("Math0123") class.SetId("abcd-defg") - res_class, err := b.CreateEducationClass(context.Background(), *class) + resClass, err := b.CreateEducationClass(context.Background(), *class) lm.AssertNumberOfCalls(t, "Add", 1) lm.AssertNumberOfCalls(t, "Search", 1) assert.Nil(t, err) - assert.NotNil(t, res_class) - assert.Equal(t, res_class.GetDisplayName(), class.GetDisplayName()) - assert.Equal(t, res_class.GetId(), class.GetId()) - assert.Equal(t, res_class.GetExternalId(), class.GetExternalId()) - assert.Equal(t, res_class.GetClassification(), class.GetClassification()) + assert.NotNil(t, resClass) + assert.Equal(t, resClass.GetDisplayName(), class.GetDisplayName()) + assert.Equal(t, resClass.GetId(), class.GetId()) + assert.Equal(t, resClass.GetExternalId(), class.GetExternalId()) + assert.Equal(t, resClass.GetClassification(), class.GetClassification()) } func TestGetEducationClasses(t *testing.T) { @@ -268,7 +268,7 @@ func TestGetEducationClassMembers(t *testing.T) { for _, tt := range tests { lm := &mocks.Client{} - user_sr := &ldap.SearchRequest{ + userSr := &ldap.SearchRequest{ BaseDN: "uid=user", Scope: 0, SizeLimit: 1, @@ -276,7 +276,7 @@ func TestGetEducationClassMembers(t *testing.T) { Attributes: []string{"displayname", "entryUUID", "mail", "uid", "sn", "givenname", "userEnabledAttribute", "userTypeAttribute"}, Controls: []ldap.Control(nil), } - lm.On("Search", user_sr).Return(&ldap.SearchResult{Entries: []*ldap.Entry{userEntry}}, nil) + lm.On("Search", userSr).Return(&ldap.SearchResult{Entries: []*ldap.Entry{userEntry}}, nil) sr := &ldap.SearchRequest{ BaseDN: "ou=groups,dc=test", Scope: 2, diff --git a/services/graph/pkg/identity/ldap_education_school.go b/services/graph/pkg/identity/ldap_education_school.go index a412d77a0..fbd846570 100644 --- a/services/graph/pkg/identity/ldap_education_school.go +++ b/services/graph/pkg/identity/ldap_education_school.go @@ -50,7 +50,7 @@ const ( const ldapDateFormat = "20060102150405Z0700" var ( - errNotSet = errors.New("Attribute not set") + errNotSet = errors.New("attribute not set") errSchoolNameExists = errorcode.New(errorcode.NameAlreadyExists, "A school with that name is already present") errSchoolNumberExists = errorcode.New(errorcode.NameAlreadyExists, "A school with that number is already present") ) @@ -761,7 +761,7 @@ func (i *LDAP) getTerminationDate(e *ldap.Entry) (*time.Time, error) { } t, err := time.Parse(ldapDateFormat, dateString) if err != nil { - err = fmt.Errorf("Error parsing LDAP date: '%s': %w", dateString, err) + err = fmt.Errorf("error parsing LDAP date: '%s': %w", dateString, err) return nil, err } return &t, nil diff --git a/services/graph/pkg/identity/ldap_education_school_test.go b/services/graph/pkg/identity/ldap_education_school_test.go index b5efbf10b..7ee07bc85 100644 --- a/services/graph/pkg/identity/ldap_education_school_test.go +++ b/services/graph/pkg/identity/ldap_education_school_test.go @@ -184,18 +184,18 @@ func TestCreateEducationSchool(t *testing.T) { school.SetDisplayName(tt.schoolName) school.SetSchoolNumber(tt.schoolNumber) school.SetId("abcd-defg") - res_school, err := b.CreateEducationSchool(context.Background(), *school) + resSchool, err := b.CreateEducationSchool(context.Background(), *school) if tt.expectedError == nil { assert.Nil(t, err) lm.AssertNumberOfCalls(t, "Add", 1) - assert.NotNil(t, res_school) - assert.Equal(t, res_school.GetDisplayName(), school.GetDisplayName()) - assert.Equal(t, res_school.GetId(), school.GetId()) - assert.Equal(t, res_school.GetSchoolNumber(), school.GetSchoolNumber()) - assert.False(t, res_school.HasTerminationDate()) + assert.NotNil(t, resSchool) + assert.Equal(t, resSchool.GetDisplayName(), school.GetDisplayName()) + assert.Equal(t, resSchool.GetId(), school.GetId()) + assert.Equal(t, resSchool.GetSchoolNumber(), school.GetSchoolNumber()) + assert.False(t, resSchool.HasTerminationDate()) } else { assert.Equal(t, err, tt.expectedError) - assert.Nil(t, res_school) + assert.Nil(t, resSchool) } } } @@ -238,15 +238,15 @@ func TestUpdateEducationSchoolTerminationDate(t *testing.T) { school := libregraph.NewEducationSchool() terminationTime := time.Date(2042, time.January, 31, 12, 0, 0, 0, time.UTC) school.SetTerminationDate(terminationTime) - res_school, err := b.UpdateEducationSchool(context.Background(), "abcd-defg", *school) + resSchool, err := b.UpdateEducationSchool(context.Background(), "abcd-defg", *school) lm.AssertNumberOfCalls(t, "Search", 2) assert.Nil(t, err) - assert.NotNil(t, res_school) - assert.Equal(t, "Test School", res_school.GetDisplayName()) - assert.Equal(t, "abcd-defg", res_school.GetId()) - assert.Equal(t, "0123", res_school.GetSchoolNumber()) - assert.True(t, res_school.HasTerminationDate()) - assert.True(t, terminationTime.Equal(res_school.GetTerminationDate())) + assert.NotNil(t, resSchool) + assert.Equal(t, "Test School", resSchool.GetDisplayName()) + assert.Equal(t, "abcd-defg", resSchool.GetId()) + assert.Equal(t, "0123", resSchool.GetSchoolNumber()) + assert.True(t, resSchool.HasTerminationDate()) + assert.True(t, terminationTime.Equal(resSchool.GetTerminationDate())) } func TestUpdateEducationSchoolOperation(t *testing.T) { diff --git a/services/graph/pkg/identity/ldap_education_user.go b/services/graph/pkg/identity/ldap_education_user.go index 4d0b2750b..1ea76ca4e 100644 --- a/services/graph/pkg/identity/ldap_education_user.go +++ b/services/graph/pkg/identity/ldap_education_user.go @@ -55,7 +55,7 @@ func (i *LDAP) CreateEducationUser(ctx context.Context, user libregraph.Educatio return i.createEducationUserModelFromLDAP(e), nil } -// DeleteEducationUser deletes a given educationuser, identified by username or id, from the backend +// DeleteEducationUser deletes a given education user, identified by username or id, from the backend func (i *LDAP) DeleteEducationUser(ctx context.Context, nameOrID string) error { logger := i.logger.SubloggerWithRequestID(ctx) logger.Debug().Str("backend", "ldap").Msg("DeleteEducationUser") @@ -145,7 +145,7 @@ func (i *LDAP) UpdateEducationUser(ctx context.Context, nameOrID string, user li } if user.PasswordProfile != nil && user.PasswordProfile.GetPassword() != "" { if i.usePwModifyExOp { - if err := i.updateUserPassowrd(ctx, e.DN, user.PasswordProfile.GetPassword()); err != nil { + if err := i.updateUserPassword(ctx, e.DN, user.PasswordProfile.GetPassword()); err != nil { return nil, err } } else { @@ -182,7 +182,7 @@ func (i *LDAP) UpdateEducationUser(ctx context.Context, nameOrID string, user li returnUser := i.createEducationUserModelFromLDAP(e) - // To avoid an ldap lookup for group membership, set the enabled flag to same as input value + // To avoid a ldap lookup for group membership, set the enabled flag to same as input value // since this would have been updated with group membership from the input anyway. if user.AccountEnabled != nil && i.disableUserMechanism == DisableMechanismGroup { returnUser.AccountEnabled = user.AccountEnabled diff --git a/services/graph/pkg/identity/ldap_group.go b/services/graph/pkg/identity/ldap_group.go index ed55ea00a..998e63c80 100644 --- a/services/graph/pkg/identity/ldap_group.go +++ b/services/graph/pkg/identity/ldap_group.go @@ -280,7 +280,7 @@ func (i *LDAP) UpdateGroupName(ctx context.Context, groupID string, groupName st } // AddMembersToGroup implements the Backend Interface for the LDAP backend. -// Currently it is limited to adding Users as Group members. Adding other groups +// Currently, it is limited to adding Users as Group members. Adding other groups // as members is not yet implemented func (i *LDAP) AddMembersToGroup(ctx context.Context, groupID string, memberIDs []string) error { logger := i.logger.SubloggerWithRequestID(ctx) @@ -340,17 +340,17 @@ func (i *LDAP) AddMembersToGroup(ctx context.Context, groupID string, memberIDs if len(newMemberDN) > 0 { // Small retry loop. It might be that, when reading the group we found the empty group member ("", - // line 289 above). Our modify operation tries to delete that value. However another go-routine + // line 289 above). Our modify operation tries to delete that value. However, another go-routine // might have done that in parallel. In that case // (LDAPResultNoSuchAttribute) we need to retry the modification - // without the delete. + // without to delete. for j := 0; j < 2; j++ { mr.Add(i.groupAttributeMap.member, newMemberDN) if err := i.conn.Modify(&mr); err != nil { if lerr, ok := err.(*ldap.Error); ok { switch lerr.ResultCode { case ldap.LDAPResultAttributeOrValueExists: - err = fmt.Errorf("Duplicate member entries in request") + err = fmt.Errorf("duplicate member entries in request") case ldap.LDAPResultNoSuchAttribute: if len(mr.Changes) == 2 { // We tried the special case for adding the first group member, but some @@ -363,7 +363,7 @@ func (i *LDAP) AddMembersToGroup(ctx context.Context, groupID string, memberIDs } default: logger.Info().Err(err).Msg("Failed to modify group member entries on PATCH group") - err = fmt.Errorf("Unknown error when trying to modify group member entries") + err = fmt.Errorf("unknown error when trying to modify group member entries") } } return err @@ -437,7 +437,7 @@ func (i *LDAP) groupToLDAPAttrValues(group libregraph.Group) (map[string][]strin // as required attribute for groupOfNames/groupOfUniqueNames. So we // add an empty string (which is a valid DN) as the initial member. // It will be replaced once real members are added. - // We might wanna use the newer, but not so broadly used "groupOfMembers" + // We might want to use the newer, but not so broadly used "groupOfMembers" // objectclass (RFC2307bis-02) where "member" is optional. i.groupAttributeMap.member: {""}, } @@ -452,7 +452,7 @@ func (i *LDAP) groupToLDAPAttrValues(group libregraph.Group) (map[string][]strin func (i *LDAP) getLDAPGroupByID(id string, requestMembers bool) (*ldap.Entry, error) { idString, err := filterEscapeUUID(i.groupIDisOctetString, id) if err != nil { - return nil, fmt.Errorf("Invalid group id: %w", err) + return nil, fmt.Errorf("invalid group id: %w", err) } filter := fmt.Sprintf("(%s=%s)", i.groupAttributeMap.id, idString) return i.getLDAPGroupByFilter(filter, requestMembers) @@ -460,7 +460,7 @@ func (i *LDAP) getLDAPGroupByID(id string, requestMembers bool) (*ldap.Entry, er func (i *LDAP) getLDAPGroupByNameOrID(nameOrID string, requestMembers bool) (*ldap.Entry, error) { idString, err := filterEscapeUUID(i.groupIDisOctetString, nameOrID) - // err != nil just means that this is not a uuid so we can skip the uuid filterpart + // err != nil just means that this is not an uuid, so we can skip the uuid filter part // and just filter by name filter := "" if err == nil { diff --git a/services/graph/pkg/identity/ldap_group_test.go b/services/graph/pkg/identity/ldap_group_test.go index beb66d901..b228a16bb 100644 --- a/services/graph/pkg/identity/ldap_group_test.go +++ b/services/graph/pkg/identity/ldap_group_test.go @@ -45,7 +45,7 @@ var groupLookupSearchRequest = &ldap.SearchRequest{ Controls: []ldap.Control(nil), } -var groupListSeachRequest = &ldap.SearchRequest{ +var groupListSearchRequest = &ldap.SearchRequest{ BaseDN: "ou=groups,dc=test", Scope: 2, Filter: "(&(objectClass=groupOfNames))", @@ -273,7 +273,7 @@ func TestGetGroups(t *testing.T) { if err != nil { t.Errorf("Expected success, got '%s'", err.Error()) } - lm.On("Search", groupListSeachRequest).Return(&ldap.SearchResult{Entries: []*ldap.Entry{groupEntry}}, nil) + lm.On("Search", groupListSearchRequest).Return(&ldap.SearchResult{Entries: []*ldap.Entry{groupEntry}}, nil) lm.On("Search", sr2).Return(&ldap.SearchResult{Entries: []*ldap.Entry{userEntry}}, nil) lm.On("Search", sr3).Return(&ldap.SearchResult{Entries: []*ldap.Entry{invalidUserEntry}}, nil) b, _ = getMockedBackend(lm, lconfig, &logger) @@ -439,8 +439,8 @@ func TestUpdateGroupName(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { lm := &mocks.Client{} - for _, mock := range tt.ldapMocks { - lm.On(mock.funcName, mock.args...).Return(mock.returns...) + for _, ldapMock := range tt.ldapMocks { + lm.On(ldapMock.funcName, ldapMock.args...).Return(ldapMock.returns...) } ldapConfig := lconfig diff --git a/services/graph/pkg/identity/ldap_test.go b/services/graph/pkg/identity/ldap_test.go index a936a7190..71431c674 100644 --- a/services/graph/pkg/identity/ldap_test.go +++ b/services/graph/pkg/identity/ldap_test.go @@ -1431,8 +1431,8 @@ func TestUpdateUser(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { lm := &mocks.Client{} - for _, mock := range tt.ldapMocks { - lm.On(mock.funcName, mock.args...).Return(mock.returns...) + for _, ldapMock := range tt.ldapMocks { + lm.On(ldapMock.funcName, ldapMock.args...).Return(ldapMock.returns...) } ldapConfig := lconfig @@ -1659,7 +1659,7 @@ func TestUsersEnabledState(t *testing.T) { returns: []interface{}{ nil, &ldap.Error{ - Err: fmt.Errorf("Very Problematic Problems"), + Err: fmt.Errorf("very problematic problems"), }, }, }, @@ -1669,8 +1669,8 @@ func TestUsersEnabledState(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { lm := &mocks.Client{} - for _, mock := range tt.ldapMocks { - lm.On(mock.funcName, mock.args...).Return(mock.returns...) + for _, ldapMock := range tt.ldapMocks { + lm.On(ldapMock.funcName, ldapMock.args...).Return(ldapMock.returns...) } ldapConfig := lconfig diff --git a/services/graph/pkg/logging/logging.go b/services/graph/pkg/logging/logging.go index d48a2d315..90602d417 100644 --- a/services/graph/pkg/logging/logging.go +++ b/services/graph/pkg/logging/logging.go @@ -5,7 +5,7 @@ import ( "github.com/owncloud/ocis/v2/services/graph/pkg/config" ) -// LoggerFromConfig initializes a service-specific logger instance. +// Configure initializes a service-specific logger instance. func Configure(name string, cfg *config.Log) log.Logger { return log.NewLogger( log.Name(name), diff --git a/services/graph/pkg/server/debug/server.go b/services/graph/pkg/server/debug/server.go index 4b6ad6cec..314ef1b78 100644 --- a/services/graph/pkg/server/debug/server.go +++ b/services/graph/pkg/server/debug/server.go @@ -35,7 +35,7 @@ func health(cfg *config.Config) func(http.ResponseWriter, *http.Request) { // TODO: check if services are up and running _, err := io.WriteString(w, http.StatusText(http.StatusOK)) - // io.WriteString should not fail but if it does we want to know. + // io.WriteString should not fail but if it does, we want to know. if err != nil { panic(err) } @@ -51,7 +51,7 @@ func ready(cfg *config.Config) func(http.ResponseWriter, *http.Request) { // TODO: check if services are up and running _, err := io.WriteString(w, http.StatusText(http.StatusOK)) - // io.WriteString should not fail but if it does we want to know. + // io.WriteString should not fail but if it does, we want to know. if err != nil { panic(err) } diff --git a/services/graph/pkg/server/http/server.go b/services/graph/pkg/server/http/server.go index cf84d68d4..53f987f38 100644 --- a/services/graph/pkg/server/http/server.go +++ b/services/graph/pkg/server/http/server.go @@ -114,7 +114,7 @@ func Server(opts ...Option) (http.Service, error) { requireAdminMiddleware = func(next stdhttp.Handler) stdhttp.Handler { return next } - // no gatewayclient needed + // no gateway client needed } // Keycloak client is optional, so if it stays nil, it's fine. diff --git a/services/graph/pkg/service/v0/api_drives_drive_item.go b/services/graph/pkg/service/v0/api_drives_drive_item.go index ade5e5fb5..deb1f3ee3 100644 --- a/services/graph/pkg/service/v0/api_drives_drive_item.go +++ b/services/graph/pkg/service/v0/api_drives_drive_item.go @@ -50,14 +50,14 @@ func NewDrivesDriveItemService(logger log.Logger, gatewaySelector pool.Selectabl }, nil } -// UnmountShare unmounts a share from the sharejail +// UnmountShare unmounts a share from the share-jail func (s DrivesDriveItemService) UnmountShare(ctx context.Context, resourceID storageprovider.ResourceId) error { gatewayClient, err := s.gatewaySelector.Next() if err != nil { return err } - // This is a a bit of a hack. We should not rely on a specific format of the item id. + // This is a bit of a hack. We should not rely on a specific format of the item id. // But currently there is no other way to get the ShareID. shareId := resourceID.GetOpaqueId() @@ -165,7 +165,7 @@ func (s DrivesDriveItemService) MountShare(ctx context.Context, resourceID stora var acceptedShares []*collaboration.ReceivedShare - // try to accept all of the received shares for this resource. So that the stat is in sync across all + // try to accept all the received shares for this resource. So that the stat is in sync across all // shares for _, receivedShare := range receivedSharesResponse.GetShares() { updateMask := &fieldmaskpb.FieldMask{Paths: []string{_fieldMaskPathState}} @@ -211,13 +211,13 @@ func (s DrivesDriveItemService) MountShare(ctx context.Context, resourceID stora return libregraph.DriveItem{}, errors.Join(errs...) } - // As the accepted shares are all for the same resource they should collapse to a single driveitem + // As the accepted shares are all for the same resource they should collapse to a single drive-item items, err := cs3ReceivedSharesToDriveItems(ctx, &s.logger, gatewayClient, s.identityCache, s.resharingEnabled, acceptedShares) switch { case err != nil: return libregraph.DriveItem{}, nil case len(items) != 1: - return libregraph.DriveItem{}, errorcode.New(errorcode.GeneralException, "failed to convert accepted shares into driveitem") + return libregraph.DriveItem{}, errorcode.New(errorcode.GeneralException, "failed to convert accepted shares into drive-item") } return items[0], nil } @@ -270,7 +270,7 @@ func (api DrivesDriveItemApi) CreateDriveItem(w http.ResponseWriter, r *http.Req ctx := r.Context() driveID, err := parseIDParam(r, "driveID") if err != nil { - api.logger.Debug().Err(err).Msg("invlid driveID") + api.logger.Debug().Err(err).Msg("invalid driveID") errorcode.InvalidRequest.Render(w, r, http.StatusUnprocessableEntity, "invalid driveID") return } diff --git a/services/graph/pkg/service/v0/driveitems.go b/services/graph/pkg/service/v0/driveitems.go index 2cc0690b6..7066f3341 100644 --- a/services/graph/pkg/service/v0/driveitems.go +++ b/services/graph/pkg/service/v0/driveitems.go @@ -589,8 +589,8 @@ func (g Graph) Invite(w http.ResponseWriter, r *http.Request) { if id := createShareResponse.GetShare().GetId().GetOpaqueId(); id != "" { permission.Id = conversions.ToPointer(id) } else if IsSpaceRoot(statResponse.GetInfo().GetId()) { - // permissions on a space root are not handled by a share manager so - // they don't get a shareid + // permissions on a space root are not handled by a share manager, so + // they don't get a share-id permission.SetId(identitySetToSpacePermissionID(permission.GetGrantedToV2())) } @@ -691,7 +691,7 @@ func (g Graph) DeletePermission(w http.ResponseWriter, r *http.Request) { // Check if the ID is referring to a public share case err == nil: permissionType = Public - // If the item id is referring to a space root an this is not a public share + // If the item id is referring to a space root and this is not a public share // we have to deal with space permissions case IsSpaceRoot(&itemID): permissionType = Space @@ -776,15 +776,15 @@ func (g Graph) getPermissionByID(ctx context.Context, permissionID string, itemI var errcode errorcode.Error if errors.As(err, &errcode) && errcode.GetCode() == errorcode.ItemNotFound { // there is no public link with that id, check if this is a user share - share, err := g.getCS3UserShareByID(ctx, permissionID) + shareById, err := g.getCS3UserShareByID(ctx, permissionID) if err != nil { return nil, nil, err } - permission, err := g.cs3UserShareToPermission(ctx, share, false) + permission, err := g.cs3UserShareToPermission(ctx, shareById, false) if err != nil { return nil, nil, err } - return permission, share.GetResourceId(), nil + return permission, shareById.GetResourceId(), nil } return nil, nil, err @@ -806,11 +806,11 @@ func (g Graph) getSpaceRootPermissions(ctx context.Context, spaceID *storageprov } func (g Graph) getUserPermissionResourceID(ctx context.Context, permissionID string) (*storageprovider.ResourceId, error) { - share, err := g.getCS3UserShareByID(ctx, permissionID) + shareByID, err := g.getCS3UserShareByID(ctx, permissionID) if err != nil { return nil, err } - return share.GetResourceId(), nil + return shareByID.GetResourceId(), nil } func (g Graph) getCS3UserShareByID(ctx context.Context, permissionID string) (*collaboration.Share, error) { @@ -1012,11 +1012,11 @@ func spacePermissionIdToCS3Grantee(permissionID string) (storageprovider.Grantee } func (g Graph) getLinkPermissionResourceID(ctx context.Context, permissionID string) (*storageprovider.ResourceId, error) { - share, err := g.getCS3PublicShareByID(ctx, permissionID) + shareByID, err := g.getCS3PublicShareByID(ctx, permissionID) if err != nil { return nil, err } - return share.GetResourceId(), nil + return shareByID.GetResourceId(), nil } func (g Graph) getCS3PublicShareByID(ctx context.Context, permissionID string) (*link.PublicShare, error) { diff --git a/services/groups/pkg/logging/logging.go b/services/groups/pkg/logging/logging.go index fa3a41119..ad28529c5 100644 --- a/services/groups/pkg/logging/logging.go +++ b/services/groups/pkg/logging/logging.go @@ -5,7 +5,7 @@ import ( "github.com/owncloud/ocis/v2/services/groups/pkg/config" ) -// LoggerFromConfig initializes a service-specific logger instance. +// Configure initializes a service-specific logger instance. func Configure(name string, cfg *config.Log) log.Logger { return log.NewLogger( log.Name(name), diff --git a/services/groups/pkg/server/debug/server.go b/services/groups/pkg/server/debug/server.go index c27e1da6e..bf0fe346a 100644 --- a/services/groups/pkg/server/debug/server.go +++ b/services/groups/pkg/server/debug/server.go @@ -39,7 +39,7 @@ func health(cfg *config.Config) func(http.ResponseWriter, *http.Request) { // TODO: check if services are up and running _, err := io.WriteString(w, http.StatusText(http.StatusOK)) - // io.WriteString should not fail but if it does we want to know. + // io.WriteString should not fail but if it does, we want to know. if err != nil { panic(err) } @@ -55,7 +55,7 @@ func ready(cfg *config.Config) func(http.ResponseWriter, *http.Request) { // TODO: check if services are up and running _, err := io.WriteString(w, http.StatusText(http.StatusOK)) - // io.WriteString should not fail but if it does we want to know. + // io.WriteString should not fail but if it does, we want to know. if err != nil { panic(err) } diff --git a/services/idm/pkg/logging/logging.go b/services/idm/pkg/logging/logging.go index 615554e51..1c2faed96 100644 --- a/services/idm/pkg/logging/logging.go +++ b/services/idm/pkg/logging/logging.go @@ -5,7 +5,7 @@ import ( "github.com/owncloud/ocis/v2/services/idm/pkg/config" ) -// LoggerFromConfig initializes a service-specific logger instance. +// Configure initializes a service-specific logger instance. func Configure(name string, cfg *config.Log) log.Logger { return log.NewLogger( log.Name(name), diff --git a/services/idm/pkg/server/debug/server.go b/services/idm/pkg/server/debug/server.go index 3ab54d3f7..9ac1972d4 100644 --- a/services/idm/pkg/server/debug/server.go +++ b/services/idm/pkg/server/debug/server.go @@ -35,7 +35,7 @@ func health(cfg *config.Config) func(http.ResponseWriter, *http.Request) { // TODO: check if services are up and running _, err := io.WriteString(w, http.StatusText(http.StatusOK)) - // io.WriteString should not fail but if it does we want to know. + // io.WriteString should not fail but if it does, we want to know. if err != nil { panic(err) } @@ -51,7 +51,7 @@ func ready(cfg *config.Config) func(http.ResponseWriter, *http.Request) { // TODO: check if services are up and running _, err := io.WriteString(w, http.StatusText(http.StatusOK)) - // io.WriteString should not fail but if it does we want to know. + // io.WriteString should not fail but if it does, we want to know. if err != nil { panic(err) } diff --git a/services/idp/pkg/logging/logging.go b/services/idp/pkg/logging/logging.go index 4bd94fe84..6d14e7440 100644 --- a/services/idp/pkg/logging/logging.go +++ b/services/idp/pkg/logging/logging.go @@ -5,7 +5,7 @@ import ( "github.com/owncloud/ocis/v2/services/idp/pkg/config" ) -// LoggerFromConfig initializes a service-specific logger instance. +// Configure initializes a service-specific logger instance. func Configure(name string, cfg *config.Log) log.Logger { return log.NewLogger( log.Name(name), diff --git a/services/idp/pkg/server/debug/server.go b/services/idp/pkg/server/debug/server.go index 8d99b20d2..f236bc69a 100644 --- a/services/idp/pkg/server/debug/server.go +++ b/services/idp/pkg/server/debug/server.go @@ -62,7 +62,7 @@ func ready(cfg *config.Config) func(http.ResponseWriter, *http.Request) { // if there is a mishap when initializing, there is a minimal (talking ms or ns window) // timeframe where this code is callable _, err := io.WriteString(w, http.StatusText(http.StatusOK)) - // io.WriteString should not fail but if it does we want to know. + // io.WriteString should not fail but if it does, we want to know. if err != nil { panic(err) } diff --git a/services/invitations/pkg/logging/logging.go b/services/invitations/pkg/logging/logging.go index a450db15a..bade349eb 100644 --- a/services/invitations/pkg/logging/logging.go +++ b/services/invitations/pkg/logging/logging.go @@ -5,7 +5,7 @@ import ( "github.com/owncloud/ocis/v2/services/invitations/pkg/config" ) -// LoggerFromConfig initializes a service-specific logger instance. +// Configure initializes a service-specific logger instance. func Configure(name string, cfg *config.Log) log.Logger { return log.NewLogger( log.Name(name), diff --git a/services/invitations/pkg/server/debug/server.go b/services/invitations/pkg/server/debug/server.go index 359df37b0..663e3c45d 100644 --- a/services/invitations/pkg/server/debug/server.go +++ b/services/invitations/pkg/server/debug/server.go @@ -39,7 +39,7 @@ func health(cfg *config.Config) func(http.ResponseWriter, *http.Request) { // TODO: check if services are up and running _, err := io.WriteString(w, http.StatusText(http.StatusOK)) - // io.WriteString should not fail but if it does we want to know. + // io.WriteString should not fail but if it does, we want to know. if err != nil { panic(err) } @@ -55,7 +55,7 @@ func ready(cfg *config.Config) func(http.ResponseWriter, *http.Request) { // TODO: check if services are up and running _, err := io.WriteString(w, http.StatusText(http.StatusOK)) - // io.WriteString should not fail but if it does we want to know. + // io.WriteString should not fail but if it does, we want to know. if err != nil { panic(err) } diff --git a/services/nats/pkg/logging/logging.go b/services/nats/pkg/logging/logging.go index 230b1d7f7..6c5643c1f 100644 --- a/services/nats/pkg/logging/logging.go +++ b/services/nats/pkg/logging/logging.go @@ -5,7 +5,7 @@ import ( "github.com/owncloud/ocis/v2/services/nats/pkg/config" ) -// LoggerFromConfig initializes a service-specific logger instance. +// Configure initializes a service-specific logger instance. func Configure(name string, cfg *config.Log) log.Logger { return log.NewLogger( log.Name(name), diff --git a/services/notifications/pkg/logging/logging.go b/services/notifications/pkg/logging/logging.go index 982389bcf..4b5c4341b 100644 --- a/services/notifications/pkg/logging/logging.go +++ b/services/notifications/pkg/logging/logging.go @@ -5,7 +5,7 @@ import ( "github.com/owncloud/ocis/v2/services/notifications/pkg/config" ) -// LoggerFromConfig initializes a service-specific logger instance. +// Configure initializes a service-specific logger instance. func Configure(name string, cfg *config.Log) log.Logger { return log.NewLogger( log.Name(name), diff --git a/services/ocdav/pkg/logging/logging.go b/services/ocdav/pkg/logging/logging.go index f5341b839..bab410617 100644 --- a/services/ocdav/pkg/logging/logging.go +++ b/services/ocdav/pkg/logging/logging.go @@ -5,7 +5,7 @@ import ( "github.com/owncloud/ocis/v2/services/ocdav/pkg/config" ) -// LoggerFromConfig initializes a service-specific logger instance. +// Configure initializes a service-specific logger instance. func Configure(name string, cfg *config.Log) log.Logger { return log.NewLogger( log.Name(name), diff --git a/services/ocdav/pkg/server/debug/server.go b/services/ocdav/pkg/server/debug/server.go index 43f2b2e74..5216000a7 100644 --- a/services/ocdav/pkg/server/debug/server.go +++ b/services/ocdav/pkg/server/debug/server.go @@ -39,7 +39,7 @@ func health(cfg *config.Config) func(http.ResponseWriter, *http.Request) { // TODO: check if services are up and running _, err := io.WriteString(w, http.StatusText(http.StatusOK)) - // io.WriteString should not fail but if it does we want to know. + // io.WriteString should not fail but if it does, we want to know. if err != nil { panic(err) } @@ -55,7 +55,7 @@ func ready(cfg *config.Config) func(http.ResponseWriter, *http.Request) { // TODO: check if services are up and running _, err := io.WriteString(w, http.StatusText(http.StatusOK)) - // io.WriteString should not fail but if it does we want to know. + // io.WriteString should not fail but if it does, we want to know. if err != nil { panic(err) } diff --git a/services/ocm/pkg/logging/logging.go b/services/ocm/pkg/logging/logging.go index 64747b5a8..87d9cdd5a 100644 --- a/services/ocm/pkg/logging/logging.go +++ b/services/ocm/pkg/logging/logging.go @@ -5,7 +5,7 @@ import ( "github.com/owncloud/ocis/v2/services/ocm/pkg/config" ) -// LoggerFromConfig initializes a service-specific logger instance. +// Configure initializes a service-specific logger instance. func Configure(name string, cfg *config.Log) log.Logger { return log.NewLogger( log.Name(name), diff --git a/services/ocm/pkg/server/debug/server.go b/services/ocm/pkg/server/debug/server.go index b2275b585..d97b3fde1 100644 --- a/services/ocm/pkg/server/debug/server.go +++ b/services/ocm/pkg/server/debug/server.go @@ -39,7 +39,7 @@ func health(cfg *config.Config) func(http.ResponseWriter, *http.Request) { // TODO: check if services are up and running _, err := io.WriteString(w, http.StatusText(http.StatusOK)) - // io.WriteString should not fail but if it does we want to know. + // io.WriteString should not fail but if it does, we want to know. if err != nil { panic(err) } @@ -55,7 +55,7 @@ func ready(cfg *config.Config) func(http.ResponseWriter, *http.Request) { // TODO: check if services are up and running _, err := io.WriteString(w, http.StatusText(http.StatusOK)) - // io.WriteString should not fail but if it does we want to know. + // io.WriteString should not fail but if it does, we want to know. if err != nil { panic(err) } diff --git a/services/ocs/pkg/logging/logging.go b/services/ocs/pkg/logging/logging.go index 9156b2b81..a0e4411f8 100644 --- a/services/ocs/pkg/logging/logging.go +++ b/services/ocs/pkg/logging/logging.go @@ -5,7 +5,7 @@ import ( "github.com/owncloud/ocis/v2/services/ocs/pkg/config" ) -// LoggerFromConfig initializes a service-specific logger instance. +// Configure initializes a service-specific logger instance. func Configure(name string, cfg *config.Log) log.Logger { return log.NewLogger( log.Name(name), diff --git a/services/ocs/pkg/server/debug/server.go b/services/ocs/pkg/server/debug/server.go index ec1446494..536c97245 100644 --- a/services/ocs/pkg/server/debug/server.go +++ b/services/ocs/pkg/server/debug/server.go @@ -39,7 +39,7 @@ func health(cfg *config.Config) func(http.ResponseWriter, *http.Request) { // TODO: check if services are up and running _, err := io.WriteString(w, http.StatusText(http.StatusOK)) - // io.WriteString should not fail but if it does we want to know. + // io.WriteString should not fail but if it does, we want to know. if err != nil { panic(err) } @@ -55,7 +55,7 @@ func ready(cfg *config.Config) func(http.ResponseWriter, *http.Request) { // TODO: check if services are up and running _, err := io.WriteString(w, http.StatusText(http.StatusOK)) - // io.WriteString should not fail but if it does we want to know. + // io.WriteString should not fail but if it does, we want to know. if err != nil { panic(err) } diff --git a/services/policies/pkg/command/server.go b/services/policies/pkg/command/server.go index 3af423b02..6f4729f69 100644 --- a/services/policies/pkg/command/server.go +++ b/services/policies/pkg/command/server.go @@ -142,7 +142,7 @@ func Server(cfg *config.Config) *cli.Command { // TODO: check if services are up and running _, err := io.WriteString(w, http.StatusText(http.StatusOK)) - // io.WriteString should not fail but if it does we want to know. + // io.WriteString should not fail but if it does, we want to know. if err != nil { panic(err) } @@ -156,7 +156,7 @@ func Server(cfg *config.Config) *cli.Command { // TODO: check if services are up and running _, err := io.WriteString(w, http.StatusText(http.StatusOK)) - // io.WriteString should not fail but if it does we want to know. + // io.WriteString should not fail but if it does, we want to know. if err != nil { panic(err) } diff --git a/services/postprocessing/pkg/logging/logging.go b/services/postprocessing/pkg/logging/logging.go index ae5a674a0..d24cac338 100644 --- a/services/postprocessing/pkg/logging/logging.go +++ b/services/postprocessing/pkg/logging/logging.go @@ -5,7 +5,7 @@ import ( "github.com/owncloud/ocis/v2/services/postprocessing/pkg/config" ) -// LoggerFromConfig initializes a service-specific logger instance. +// Configure initializes a service-specific logger instance. func Configure(name string, cfg *config.Log) log.Logger { return log.NewLogger( log.Name(name), diff --git a/services/proxy/pkg/config/config.go b/services/proxy/pkg/config/config.go index 71616f015..837a14740 100644 --- a/services/proxy/pkg/config/config.go +++ b/services/proxy/pkg/config/config.go @@ -66,7 +66,7 @@ type Route struct { Unprotected bool `yaml:"unprotected,omitempty"` } -// RouteType defines the type of a route +// RouteType defines the type of route type RouteType string const ( @@ -90,7 +90,7 @@ type AuthMiddleware struct { CredentialsByUserAgent map[string]string `yaml:"credentials_by_user_agent"` } -// PoliciesMiddleware configures the proxy policies middleware. +// PoliciesMiddleware configures the proxy's policies middleware. type PoliciesMiddleware struct { Query string `yaml:"query" env:"PROXY_POLICIES_QUERY" desc:"Defines the 'Complete Rules' variable defined in the rego rule set this step uses for its evaluation. Rules default to deny if the variable was not found." introductionVersion:"pre5.0"` } @@ -128,7 +128,7 @@ type Cache struct { Database string `yaml:"database" env:"OCIS_CACHE_DATABASE" desc:"The database name the configured store should use." introductionVersion:"pre5.0"` Table string `yaml:"table" env:"PROXY_OIDC_USERINFO_CACHE_TABLE" desc:"The database table the store should use." introductionVersion:"pre5.0"` TTL time.Duration `yaml:"ttl" env:"OCIS_CACHE_TTL;PROXY_OIDC_USERINFO_CACHE_TTL" desc:"Default time to live for user info in the user info cache. Only applied when access tokens has no expiration. See the Environment Variable Types description for more details." introductionVersion:"pre5.0"` - Size int `yaml:"size" env:"OCIS_CACHE_SIZE;PROXY_OIDC_USERINFO_CACHE_SIZE" desc:"The maximum quantity of items in the user info cache. Only applies when store type 'ocmem' is configured. Defaults to 512 which is derived from the ocmem package though not exclicitely set as default." introductionVersion:"pre5.0"` + Size int `yaml:"size" env:"OCIS_CACHE_SIZE;PROXY_OIDC_USERINFO_CACHE_SIZE" desc:"The maximum quantity of items in the user info cache. Only applies when store type 'ocmem' is configured. Defaults to 512 which is derived from the ocmem package though not explicitly set as default." introductionVersion:"pre5.0"` DisablePersistence bool `yaml:"disable_persistence" env:"OCIS_CACHE_DISABLE_PERSISTENCE;PROXY_OIDC_USERINFO_CACHE_DISABLE_PERSISTENCE" desc:"Disables persistence of the cache. Only applies when store type 'nats-js-kv' is configured. Defaults to false." introductionVersion:"pre5.0"` AuthUsername string `yaml:"username" env:"OCIS_CACHE_AUTH_USERNAME;PROXY_OIDC_USERINFO_CACHE_AUTH_USERNAME" desc:"The username to authenticate with the cache. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"` AuthPassword string `yaml:"password" env:"OCIS_CACHE_AUTH_PASSWORD;PROXY_OIDC_USERINFO_CACHE_AUTH_PASSWORD" desc:"The password to authenticate with the cache. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"` @@ -164,7 +164,7 @@ type StaticSelectorConf struct { Policy string `yaml:"policy"` } -// PreSignedURL is the config for the presigned url middleware +// PreSignedURL is the config for the pre-signed url middleware type PreSignedURL struct { AllowedHTTPMethods []string `yaml:"allowed_http_methods"` Enabled bool `yaml:"enabled" env:"PROXY_ENABLE_PRESIGNEDURLS" desc:"Allow OCS to get a signing key to sign requests." introductionVersion:"pre5.0"` diff --git a/services/proxy/pkg/logging/logging.go b/services/proxy/pkg/logging/logging.go index f4a0b6959..b5803e328 100644 --- a/services/proxy/pkg/logging/logging.go +++ b/services/proxy/pkg/logging/logging.go @@ -5,7 +5,7 @@ import ( "github.com/owncloud/ocis/v2/services/proxy/pkg/config" ) -// LoggerFromConfig initializes a service-specific logger instance. +// Configure initializes a service-specific logger instance. func Configure(name string, cfg *config.Log) log.Logger { return log.NewLogger( log.Name(name), diff --git a/services/proxy/pkg/server/debug/server.go b/services/proxy/pkg/server/debug/server.go index a3e599cbd..ae2a3349b 100644 --- a/services/proxy/pkg/server/debug/server.go +++ b/services/proxy/pkg/server/debug/server.go @@ -38,7 +38,7 @@ func health(cfg *config.Config) func(http.ResponseWriter, *http.Request) { // TODO: check if services are up and running _, err := io.WriteString(w, http.StatusText(http.StatusOK)) - // io.WriteString should not fail but if it does we want to know. + // io.WriteString should not fail but if it does, we want to know. if err != nil { panic(err) } @@ -54,7 +54,7 @@ func ready(cfg *config.Config) func(http.ResponseWriter, *http.Request) { // TODO: check if services are up and running _, err := io.WriteString(w, http.StatusText(http.StatusOK)) - // io.WriteString should not fail but if it does we want to know. + // io.WriteString should not fail but if it does, we want to know. if err != nil { panic(err) } diff --git a/services/search/pkg/server/debug/server.go b/services/search/pkg/server/debug/server.go index db1e4cedd..e1ac53041 100644 --- a/services/search/pkg/server/debug/server.go +++ b/services/search/pkg/server/debug/server.go @@ -35,7 +35,7 @@ func health(cfg *config.Config) func(http.ResponseWriter, *http.Request) { // TODO: check if services are up and running _, err := io.WriteString(w, http.StatusText(http.StatusOK)) - // io.WriteString should not fail but if it does we want to know. + // io.WriteString should not fail but if it does, we want to know. if err != nil { panic(err) } @@ -51,7 +51,7 @@ func ready(cfg *config.Config) func(http.ResponseWriter, *http.Request) { // TODO: check if services are up and running _, err := io.WriteString(w, http.StatusText(http.StatusOK)) - // io.WriteString should not fail but if it does we want to know. + // io.WriteString should not fail but if it does, we want to know. if err != nil { panic(err) } diff --git a/services/settings/pkg/logging/logging.go b/services/settings/pkg/logging/logging.go index f12ce8916..626d249f1 100644 --- a/services/settings/pkg/logging/logging.go +++ b/services/settings/pkg/logging/logging.go @@ -5,7 +5,7 @@ import ( "github.com/owncloud/ocis/v2/services/settings/pkg/config" ) -// LoggerFromConfig initializes a service-specific logger instance. +// Configure initializes a service-specific logger instance. func Configure(name string, cfg *config.Log) log.Logger { return log.NewLogger( log.Name(name), diff --git a/services/settings/pkg/server/debug/server.go b/services/settings/pkg/server/debug/server.go index e1ed5ff2c..8b667f094 100644 --- a/services/settings/pkg/server/debug/server.go +++ b/services/settings/pkg/server/debug/server.go @@ -39,7 +39,7 @@ func health(cfg *config.Config) func(http.ResponseWriter, *http.Request) { // TODO: check if services are up and running _, err := io.WriteString(w, http.StatusText(http.StatusOK)) - // io.WriteString should not fail but if it does we want to know. + // io.WriteString should not fail but if it does, we want to know. if err != nil { panic(err) } @@ -55,7 +55,7 @@ func ready(cfg *config.Config) func(http.ResponseWriter, *http.Request) { // TODO: check if services are up and running _, err := io.WriteString(w, http.StatusText(http.StatusOK)) - // io.WriteString should not fail but if it does we want to know. + // io.WriteString should not fail but if it does, we want to know. if err != nil { panic(err) } diff --git a/services/sharing/pkg/logging/logging.go b/services/sharing/pkg/logging/logging.go index 55fa28366..5cf9aa6f5 100644 --- a/services/sharing/pkg/logging/logging.go +++ b/services/sharing/pkg/logging/logging.go @@ -5,7 +5,7 @@ import ( "github.com/owncloud/ocis/v2/services/sharing/pkg/config" ) -// LoggerFromConfig initializes a service-specific logger instance. +// Configure initializes a service-specific logger instance. func Configure(name string, cfg *config.Log) log.Logger { return log.NewLogger( log.Name(name), diff --git a/services/sharing/pkg/server/debug/server.go b/services/sharing/pkg/server/debug/server.go index 7c4ffd846..818cf6012 100644 --- a/services/sharing/pkg/server/debug/server.go +++ b/services/sharing/pkg/server/debug/server.go @@ -39,7 +39,7 @@ func health(cfg *config.Config) func(http.ResponseWriter, *http.Request) { // TODO: check if services are up and running _, err := io.WriteString(w, http.StatusText(http.StatusOK)) - // io.WriteString should not fail but if it does we want to know. + // io.WriteString should not fail but if it does, we want to know. if err != nil { panic(err) } @@ -55,7 +55,7 @@ func ready(cfg *config.Config) func(http.ResponseWriter, *http.Request) { // TODO: check if services are up and running _, err := io.WriteString(w, http.StatusText(http.StatusOK)) - // io.WriteString should not fail but if it does we want to know. + // io.WriteString should not fail but if it does, we want to know. if err != nil { panic(err) } diff --git a/services/storage-publiclink/pkg/logging/logging.go b/services/storage-publiclink/pkg/logging/logging.go index c5a037c83..0aaec7845 100644 --- a/services/storage-publiclink/pkg/logging/logging.go +++ b/services/storage-publiclink/pkg/logging/logging.go @@ -5,7 +5,7 @@ import ( "github.com/owncloud/ocis/v2/services/storage-publiclink/pkg/config" ) -// LoggerFromConfig initializes a service-specific logger instance. +// Configure initializes a service-specific logger instance. func Configure(name string, cfg *config.Log) log.Logger { return log.NewLogger( log.Name(name), diff --git a/services/storage-publiclink/pkg/server/debug/server.go b/services/storage-publiclink/pkg/server/debug/server.go index 61b501b58..4cf599ced 100644 --- a/services/storage-publiclink/pkg/server/debug/server.go +++ b/services/storage-publiclink/pkg/server/debug/server.go @@ -39,7 +39,7 @@ func health(cfg *config.Config) func(http.ResponseWriter, *http.Request) { // TODO: check if services are up and running _, err := io.WriteString(w, http.StatusText(http.StatusOK)) - // io.WriteString should not fail but if it does we want to know. + // io.WriteString should not fail but if it does, we want to know. if err != nil { panic(err) } @@ -55,7 +55,7 @@ func ready(cfg *config.Config) func(http.ResponseWriter, *http.Request) { // TODO: check if services are up and running _, err := io.WriteString(w, http.StatusText(http.StatusOK)) - // io.WriteString should not fail but if it does we want to know. + // io.WriteString should not fail but if it does, we want to know. if err != nil { panic(err) } diff --git a/services/storage-shares/pkg/logging/logging.go b/services/storage-shares/pkg/logging/logging.go index f7f4151ca..636f08e3b 100644 --- a/services/storage-shares/pkg/logging/logging.go +++ b/services/storage-shares/pkg/logging/logging.go @@ -5,7 +5,7 @@ import ( "github.com/owncloud/ocis/v2/services/storage-shares/pkg/config" ) -// LoggerFromConfig initializes a service-specific logger instance. +// Configure initializes a service-specific logger instance. func Configure(name string, cfg *config.Log) log.Logger { return log.NewLogger( log.Name(name), diff --git a/services/storage-shares/pkg/server/debug/server.go b/services/storage-shares/pkg/server/debug/server.go index 159b70fdb..2f301be8b 100644 --- a/services/storage-shares/pkg/server/debug/server.go +++ b/services/storage-shares/pkg/server/debug/server.go @@ -39,7 +39,7 @@ func health(cfg *config.Config) func(http.ResponseWriter, *http.Request) { // TODO: check if services are up and running _, err := io.WriteString(w, http.StatusText(http.StatusOK)) - // io.WriteString should not fail but if it does we want to know. + // io.WriteString should not fail but if it does, we want to know. if err != nil { panic(err) } @@ -55,7 +55,7 @@ func ready(cfg *config.Config) func(http.ResponseWriter, *http.Request) { // TODO: check if services are up and running _, err := io.WriteString(w, http.StatusText(http.StatusOK)) - // io.WriteString should not fail but if it does we want to know. + // io.WriteString should not fail but if it does, we want to know. if err != nil { panic(err) } diff --git a/services/storage-system/pkg/logging/logging.go b/services/storage-system/pkg/logging/logging.go index f2419085e..3bdeafcd7 100644 --- a/services/storage-system/pkg/logging/logging.go +++ b/services/storage-system/pkg/logging/logging.go @@ -5,7 +5,7 @@ import ( "github.com/owncloud/ocis/v2/services/storage-system/pkg/config" ) -// LoggerFromConfig initializes a service-specific logger instance. +// Configure initializes a service-specific logger instance. func Configure(name string, cfg *config.Log) log.Logger { return log.NewLogger( log.Name(name), diff --git a/services/storage-system/pkg/server/debug/server.go b/services/storage-system/pkg/server/debug/server.go index 0c83d7742..b5bc0977b 100644 --- a/services/storage-system/pkg/server/debug/server.go +++ b/services/storage-system/pkg/server/debug/server.go @@ -39,7 +39,7 @@ func health(cfg *config.Config) func(http.ResponseWriter, *http.Request) { // TODO: check if services are up and running _, err := io.WriteString(w, http.StatusText(http.StatusOK)) - // io.WriteString should not fail but if it does we want to know. + // io.WriteString should not fail but if it does, we want to know. if err != nil { panic(err) } @@ -55,7 +55,7 @@ func ready(cfg *config.Config) func(http.ResponseWriter, *http.Request) { // TODO: check if services are up and running _, err := io.WriteString(w, http.StatusText(http.StatusOK)) - // io.WriteString should not fail but if it does we want to know. + // io.WriteString should not fail but if it does, we want to know. if err != nil { panic(err) } diff --git a/services/storage-users/pkg/logging/logging.go b/services/storage-users/pkg/logging/logging.go index e0576506b..0cc11e115 100644 --- a/services/storage-users/pkg/logging/logging.go +++ b/services/storage-users/pkg/logging/logging.go @@ -5,7 +5,7 @@ import ( "github.com/owncloud/ocis/v2/services/storage-users/pkg/config" ) -// LoggerFromConfig initializes a service-specific logger instance. +// Configure initializes a service-specific logger instance. func Configure(name string, cfg *config.Log) log.Logger { return log.NewLogger( log.Name(name), diff --git a/services/storage-users/pkg/server/debug/server.go b/services/storage-users/pkg/server/debug/server.go index a5dafc2a0..268324919 100644 --- a/services/storage-users/pkg/server/debug/server.go +++ b/services/storage-users/pkg/server/debug/server.go @@ -40,7 +40,7 @@ func health(cfg *config.Config) func(http.ResponseWriter, *http.Request) { // TODO: check if services are up and running _, err := io.WriteString(w, http.StatusText(http.StatusOK)) - // io.WriteString should not fail but if it does we want to know. + // io.WriteString should not fail but if it does, we want to know. if err != nil { panic(err) } @@ -56,7 +56,7 @@ func ready(cfg *config.Config) func(http.ResponseWriter, *http.Request) { // TODO: check if services are up and running _, err := io.WriteString(w, http.StatusText(http.StatusOK)) - // io.WriteString should not fail but if it does we want to know. + // io.WriteString should not fail but if it does, we want to know. if err != nil { panic(err) } diff --git a/services/store/pkg/logging/logging.go b/services/store/pkg/logging/logging.go index 13fcd3705..b65d93259 100644 --- a/services/store/pkg/logging/logging.go +++ b/services/store/pkg/logging/logging.go @@ -5,7 +5,7 @@ import ( "github.com/owncloud/ocis/v2/services/store/pkg/config" ) -// LoggerFromConfig initializes a service-specific logger instance. +// Configure initializes a service-specific logger instance. func Configure(name string, cfg *config.Log) log.Logger { return log.NewLogger( log.Name(name), diff --git a/services/store/pkg/server/debug/server.go b/services/store/pkg/server/debug/server.go index 09507ef0d..f10bba301 100644 --- a/services/store/pkg/server/debug/server.go +++ b/services/store/pkg/server/debug/server.go @@ -35,7 +35,7 @@ func health(cfg *config.Config) func(http.ResponseWriter, *http.Request) { // TODO: check if services are up and running _, err := io.WriteString(w, http.StatusText(http.StatusOK)) - // io.WriteString should not fail but if it does we want to know. + // io.WriteString should not fail but if it does, we want to know. if err != nil { panic(err) } @@ -51,7 +51,7 @@ func ready(cfg *config.Config) func(http.ResponseWriter, *http.Request) { // TODO: check if services are up and running _, err := io.WriteString(w, http.StatusText(http.StatusOK)) - // io.WriteString should not fail but if it does we want to know. + // io.WriteString should not fail but if it does, we want to know. if err != nil { panic(err) } diff --git a/services/thumbnails/pkg/logging/logging.go b/services/thumbnails/pkg/logging/logging.go index 86405182a..90603a022 100644 --- a/services/thumbnails/pkg/logging/logging.go +++ b/services/thumbnails/pkg/logging/logging.go @@ -5,7 +5,7 @@ import ( "github.com/owncloud/ocis/v2/services/thumbnails/pkg/config" ) -// LoggerFromConfig initializes a service-specific logger instance. +// Configure initializes a service-specific logger instance. func Configure(name string, cfg *config.Log) log.Logger { return log.NewLogger( log.Name(name), diff --git a/services/thumbnails/pkg/server/debug/server.go b/services/thumbnails/pkg/server/debug/server.go index 3a1ddcea7..55ad0121d 100644 --- a/services/thumbnails/pkg/server/debug/server.go +++ b/services/thumbnails/pkg/server/debug/server.go @@ -35,7 +35,7 @@ func health(cfg *config.Config) func(http.ResponseWriter, *http.Request) { // TODO: check if services are up and running _, err := io.WriteString(w, http.StatusText(http.StatusOK)) - // io.WriteString should not fail but if it does we want to know. + // io.WriteString should not fail but if it does, we want to know. if err != nil { panic(err) } @@ -51,7 +51,7 @@ func ready(cfg *config.Config) func(http.ResponseWriter, *http.Request) { // TODO: check if services are up and running _, err := io.WriteString(w, http.StatusText(http.StatusOK)) - // io.WriteString should not fail but if it does we want to know. + // io.WriteString should not fail but if it does, we want to know. if err != nil { panic(err) } diff --git a/services/userlog/pkg/logging/logging.go b/services/userlog/pkg/logging/logging.go index 691170093..ce9363a68 100644 --- a/services/userlog/pkg/logging/logging.go +++ b/services/userlog/pkg/logging/logging.go @@ -5,7 +5,7 @@ import ( "github.com/owncloud/ocis/v2/services/userlog/pkg/config" ) -// LoggerFromConfig initializes a service-specific logger instance. +// Configure initializes a service-specific logger instance. func Configure(name string, cfg *config.Log) log.Logger { return log.NewLogger( log.Name(name), diff --git a/services/users/pkg/logging/logging.go b/services/users/pkg/logging/logging.go index 88769574a..9343a52a7 100644 --- a/services/users/pkg/logging/logging.go +++ b/services/users/pkg/logging/logging.go @@ -5,7 +5,7 @@ import ( "github.com/owncloud/ocis/v2/services/users/pkg/config" ) -// LoggerFromConfig initializes a service-specific logger instance. +// Configure initializes a service-specific logger instance. func Configure(name string, cfg *config.Log) log.Logger { return log.NewLogger( log.Name(name), diff --git a/services/users/pkg/server/debug/server.go b/services/users/pkg/server/debug/server.go index b7871834c..b10bacdc2 100644 --- a/services/users/pkg/server/debug/server.go +++ b/services/users/pkg/server/debug/server.go @@ -39,7 +39,7 @@ func health(cfg *config.Config) func(http.ResponseWriter, *http.Request) { // TODO: check if services are up and running _, err := io.WriteString(w, http.StatusText(http.StatusOK)) - // io.WriteString should not fail but if it does we want to know. + // io.WriteString should not fail but if it does, we want to know. if err != nil { panic(err) } @@ -55,7 +55,7 @@ func ready(cfg *config.Config) func(http.ResponseWriter, *http.Request) { // TODO: check if services are up and running _, err := io.WriteString(w, http.StatusText(http.StatusOK)) - // io.WriteString should not fail but if it does we want to know. + // io.WriteString should not fail but if it does, we want to know. if err != nil { panic(err) } diff --git a/services/web/pkg/logging/logging.go b/services/web/pkg/logging/logging.go index c0a956944..3d681b559 100644 --- a/services/web/pkg/logging/logging.go +++ b/services/web/pkg/logging/logging.go @@ -5,7 +5,7 @@ import ( "github.com/owncloud/ocis/v2/services/web/pkg/config" ) -// LoggerFromConfig initializes a service-specific logger instance. +// Configure initializes a service-specific logger instance. func Configure(name string, cfg *config.Log) log.Logger { return log.NewLogger( log.Name(name), diff --git a/services/web/pkg/server/debug/server.go b/services/web/pkg/server/debug/server.go index 4fa164df7..04d59e2b9 100644 --- a/services/web/pkg/server/debug/server.go +++ b/services/web/pkg/server/debug/server.go @@ -35,7 +35,7 @@ func health(cfg *config.Config) func(http.ResponseWriter, *http.Request) { // TODO: check if services are up and running _, err := io.WriteString(w, http.StatusText(http.StatusOK)) - // io.WriteString should not fail but if it does we want to know. + // io.WriteString should not fail but if it does, we want to know. if err != nil { panic(err) } @@ -51,7 +51,7 @@ func ready(cfg *config.Config) func(http.ResponseWriter, *http.Request) { // TODO: check if services are up and running _, err := io.WriteString(w, http.StatusText(http.StatusOK)) - // io.WriteString should not fail but if it does we want to know. + // io.WriteString should not fail but if it does, we want to know. if err != nil { panic(err) } diff --git a/services/webdav/pkg/logging/logging.go b/services/webdav/pkg/logging/logging.go index e7e5fed88..127592054 100644 --- a/services/webdav/pkg/logging/logging.go +++ b/services/webdav/pkg/logging/logging.go @@ -5,7 +5,7 @@ import ( "github.com/owncloud/ocis/v2/services/webdav/pkg/config" ) -// LoggerFromConfig initializes a service-specific logger instance. +// Configure initializes a service-specific logger instance. func Configure(name string, cfg *config.Log) log.Logger { return log.NewLogger( log.Name(name), diff --git a/services/webdav/pkg/server/debug/server.go b/services/webdav/pkg/server/debug/server.go index e9b9d3c90..8c4bd1c6c 100644 --- a/services/webdav/pkg/server/debug/server.go +++ b/services/webdav/pkg/server/debug/server.go @@ -39,7 +39,7 @@ func health(cfg *config.Config) func(http.ResponseWriter, *http.Request) { // TODO: check if services are up and running _, err := io.WriteString(w, http.StatusText(http.StatusOK)) - // io.WriteString should not fail but if it does we want to know. + // io.WriteString should not fail but if it does, we want to know. if err != nil { panic(err) } @@ -55,7 +55,7 @@ func ready(cfg *config.Config) func(http.ResponseWriter, *http.Request) { // TODO: check if services are up and running _, err := io.WriteString(w, http.StatusText(http.StatusOK)) - // io.WriteString should not fail but if it does we want to know. + // io.WriteString should not fail but if it does, we want to know. if err != nil { panic(err) } diff --git a/services/webfinger/pkg/logging/logging.go b/services/webfinger/pkg/logging/logging.go index cd9c29f4b..2e2be5d58 100644 --- a/services/webfinger/pkg/logging/logging.go +++ b/services/webfinger/pkg/logging/logging.go @@ -5,7 +5,7 @@ import ( "github.com/owncloud/ocis/v2/services/webfinger/pkg/config" ) -// LoggerFromConfig initializes a service-specific logger instance. +// Configure initializes a service-specific logger instance. func Configure(name string, cfg *config.Log) log.Logger { return log.NewLogger( log.Name(name), diff --git a/services/webfinger/pkg/server/debug/server.go b/services/webfinger/pkg/server/debug/server.go index b21ec5ec3..27719954f 100644 --- a/services/webfinger/pkg/server/debug/server.go +++ b/services/webfinger/pkg/server/debug/server.go @@ -39,7 +39,7 @@ func health(cfg *config.Config) func(http.ResponseWriter, *http.Request) { // TODO: check if services are up and running _, err := io.WriteString(w, http.StatusText(http.StatusOK)) - // io.WriteString should not fail but if it does we want to know. + // io.WriteString should not fail but if it does, we want to know. if err != nil { panic(err) } @@ -55,7 +55,7 @@ func ready(cfg *config.Config) func(http.ResponseWriter, *http.Request) { // TODO: check if services are up and running _, err := io.WriteString(w, http.StatusText(http.StatusOK)) - // io.WriteString should not fail but if it does we want to know. + // io.WriteString should not fail but if it does, we want to know. if err != nil { panic(err) }