diff --git a/.drone.env b/.drone.env index 4cc690e0985..a8f36753cf8 100644 --- a/.drone.env +++ b/.drone.env @@ -1,7 +1,7 @@ # The test runner source for API tests -CORE_COMMITID=76048f490ac50af03594d181c5baf49f87c18b6e +CORE_COMMITID=db3913cd9ba67b2d603f8917017734903dfd432a CORE_BRANCH=master # The test runner source for UI tests -WEB_COMMITID=52c0a3e8d0c0a2a8a342ed2656254afe03725260 +WEB_COMMITID=4828c892d292dbccd382104c11486bc5d21340b0 WEB_BRANCH=master diff --git a/.drone.star b/.drone.star index 1ac30b73526..95fe42377fe 100644 --- a/.drone.star +++ b/.drone.star @@ -33,7 +33,7 @@ PLUGINS_S3 = "plugins/s3:latest" PLUGINS_S3_CACHE = "plugins/s3-cache:1" PLUGINS_SLACK = "plugins/slack:1" REDIS = "redis:6-alpine" -SELENIUM_STANDALONE_CHROME_DEBUG = "selenium/standalone-chrome-debug:3.141.59" +SELENIUM_STANDALONE_CHROME = "selenium/standalone-chrome:104.0-20220812" SONARSOURCE_SONAR_SCANNER_CLI = "sonarsource/sonar-scanner-cli:latest" THEGEEKLAB_DRONE_GITHUB_COMMENT = "thegeeklab/drone-github-comment:1" @@ -333,7 +333,7 @@ def testPipelines(ctx): pipelines += litmus(ctx, "ocis") if "skip" not in config["cs3ApiTests"] or not config["cs3ApiTests"]["skip"]: - pipelines += [cs3ApiTests(ctx, "ocis", "default")] + pipelines.append(cs3ApiTests(ctx, "ocis", "default")) if "skip" not in config["localApiTests"] or not config["localApiTests"]["skip"]: pipelines += [ localApiTests(ctx, "ocis", "apiAccountsHashDifficulty"), @@ -1955,7 +1955,7 @@ def selenium(): return [ { "name": "selenium", - "image": SELENIUM_STANDALONE_CHROME_DEBUG, + "image": SELENIUM_STANDALONE_CHROME, "volumes": [{ "name": "uploads", "path": "/uploads", diff --git a/CHANGELOG.md b/CHANGELOG.md index 10f35bcc85a..6d713b52766 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,15 +6,37 @@ The following sections list the changes for unreleased. ## Summary +* Bugfix - Fix configuration of mimetypes for the app registry: [#4411](https://github.com/owncloud/ocis/pull/4411) +* Bugfix - Show help for some commands when unconfigured: [#4405](https://github.com/owncloud/ocis/pull/4405) * Bugfix - Autocreate IDP private key also if file exists but is empty: [#4394](https://github.com/owncloud/ocis/pull/4394) +* Bugfix - Rename extensions to services (leftover occurences): [#4407](https://github.com/owncloud/ocis/pull/4407) * Change - Rename "uploads purge" command to "uploads clean": [#4403](https://github.com/owncloud/ocis/pull/4403) * Enhancement - Add /app/open-with-web endpoint: [#4376](https://github.com/owncloud/ocis/pull/4376) * Enhancement - Added language option to the app provider: [#4399](https://github.com/owncloud/ocis/pull/4399) +* Enhancement - Add configuration options for mail authentication and encryption: [#4443](https://github.com/owncloud/ocis/pull/4443) * Enhancement - Added command to reset administrator password: [#4084](https://github.com/owncloud/ocis/issues/4084) -* Enhancement - Update reva to vx.x.x: [#4376](https://github.com/owncloud/ocis/pull/4376) +* Enhancement - Rewrite of the request authentication middleware: [#4374](https://github.com/owncloud/ocis/pull/4374) +* Enhancement - Update reva to v2.8.0: [#4444](https://github.com/owncloud/ocis/pull/4444) +* Enhancement - Update ownCloud Web to v5.7.0-rc.10: [#4439](https://github.com/owncloud/ocis/pull/4439) ## Details +* Bugfix - Fix configuration of mimetypes for the app registry: [#4411](https://github.com/owncloud/ocis/pull/4411) + + We've fixed the configuration option for mimetypes in the app registry. Previously the + default config would always be merged over the user provided configuration. Now the default + mimetype configuration is only used if the user does not providy any mimetype configuration + (like it is already done in the proxy with the routes configuration). + + https://github.com/owncloud/ocis/pull/4411 + +* Bugfix - Show help for some commands when unconfigured: [#4405](https://github.com/owncloud/ocis/pull/4405) + + We've fixed some commands to show the help also when oCIS is not yet configured. Previously the + help was not displayed to the user but instead a configuration validation error. + + https://github.com/owncloud/ocis/pull/4405 + * Bugfix - Autocreate IDP private key also if file exists but is empty: [#4394](https://github.com/owncloud/ocis/pull/4394) We've fixed the behavior for the IDP private key generation so that a private key is also @@ -22,6 +44,13 @@ The following sections list the changes for unreleased. https://github.com/owncloud/ocis/pull/4394 +* Bugfix - Rename extensions to services (leftover occurences): [#4407](https://github.com/owncloud/ocis/pull/4407) + + We've already renamed extensions to services in previous PRs and this PR peforms this rename + for leftover occurences. + + https://github.com/owncloud/ocis/pull/4407 + * Change - Rename "uploads purge" command to "uploads clean": [#4403](https://github.com/owncloud/ocis/pull/4403) We've renamed the storage-users service's "uploads purge" command to "upload clean". @@ -45,6 +74,18 @@ The following sections list the changes for unreleased. https://github.com/owncloud/ocis/pull/4399 https://github.com/cs3org/reva/pull/3156 +* Enhancement - Add configuration options for mail authentication and encryption: [#4443](https://github.com/owncloud/ocis/pull/4443) + + We've added configuration options to configure the authentication and encryption for + sending mails in the notifications service. + + Furthermore there is now a distinguished configuration option for the username to use for + authentication against the mail server. This allows you to customize the sender address to + your liking. For example sender addresses like `my oCIS instance ` are + now possible, too. + + https://github.com/owncloud/ocis/pull/4443 + * Enhancement - Added command to reset administrator password: [#4084](https://github.com/owncloud/ocis/issues/4084) The new command `ocis idm resetpassword` allows to reset the administrator password when ocis @@ -53,13 +94,61 @@ The following sections list the changes for unreleased. https://github.com/owncloud/ocis/issues/4084 https://github.com/owncloud/ocis/pull/4365 -* Enhancement - Update reva to vx.x.x: [#4376](https://github.com/owncloud/ocis/pull/4376) +* Enhancement - Rewrite of the request authentication middleware: [#4374](https://github.com/owncloud/ocis/pull/4374) - Updated reva to version x.x.x. This update includes: + There were some flaws in the authentication middleware which were resolved by this rewrite. + This rewrite also introduced the need to manually mark certain paths as "unprotected" if + requests to these paths must not be authenticated. - * TODO: + https://github.com/owncloud/ocis/pull/4374 - https://github.com/owncloud/ocis/pull/4376 +* Enhancement - Update reva to v2.8.0: [#4444](https://github.com/owncloud/ocis/pull/4444) + + Updated reva to version 2.8.0. This update includes: + + * Bugfix [cs3org/reva#3158](https://github.com/cs3org/reva/pull/3158): Add name to the propfind response + * Bugfix [cs3org/reva#3157](https://github.com/cs3org/reva/pull/3157): Fix locking response codes + * Bugfix [cs3org/reva#3152](https://github.com/cs3org/reva/pull/3152): Disable caching of not found stat responses + * Bugfix [cs3org/reva#4251](https://github.com/cs3org/reva/pull/4251): Disable caching + * Enhancement [cs3org/reva#3154](https://github.com/cs3org/reva/pull/3154): Dataproviders now return file metadata + * Enhancement [cs3org/reva#3143](https://github.com/cs3org/reva/pull/3143): Add /app/open-with-web endpoint + * Enhancement [cs3org/reva#3156](https://github.com/cs3org/reva/pull/3156): Added language option to the app provider + * Enhancement [cs3org/reva#3148](https://github.com/cs3org/reva/pull/3148): Add new jsoncs3 share manager + + https://github.com/owncloud/ocis/pull/4444 + +* Enhancement - Update ownCloud Web to v5.7.0-rc.10: [#4439](https://github.com/owncloud/ocis/pull/4439) + + Tags: web + + We updated ownCloud Web to v5.7.0-rc.10. Please refer to the changelog (linked) for details on + the web release. + + * Bugfix [owncloud/web#7443](https://github.com/owncloud/web/pull/7443): Datetime formatting + * Bugfix [owncloud/web#7437](https://github.com/owncloud/web/pull/7437): Default to user context + * Bugfix [owncloud/web#7473](https://github.com/owncloud/web/pull/7473): Dragging a file causes no selection + * Bugfix [owncloud/web#7469](https://github.com/owncloud/web/pull/7469): File size not updated while restoring file version + * Bugfix [owncloud/web#7443](https://github.com/owncloud/web/pull/7443): File size formatting + * Bugfix [owncloud/web#7474](https://github.com/owncloud/web/pull/7474): Load only supported thumbnails (configurable) + * Bugfix [owncloud/web#7309](https://github.com/owncloud/web/pull/7309): SidebarNavItem icon flickering + * Bugfix [owncloud/web#7425](https://github.com/owncloud/web/pull/7425): Open Folder in project space context menu + * Bugfix [owncloud/web#7486](https://github.com/owncloud/web/issues/7486): Prevent unnecessary PROPFIND request during upload + * Bugfix [owncloud/web#7415](https://github.com/owncloud/web/pull/7415): Re-fetch quota + * Bugfix [owncloud/web#7478](https://github.com/owncloud/web/issues/7478): "Shared via"-indicator for links + * Bugfix [owncloud/web#7480](https://github.com/owncloud/web/issues/7480): Missing space image in sidebar + * Bugfix [owncloud/web#7436](https://github.com/owncloud/web/issues/7436): Hide share actions for space viewers/editors + * Bugfix [owncloud/web#7445](https://github.com/owncloud/web/pull/7445): User management app close side bar throws error + * Enhancement [owncloud/web#7309](https://github.com/owncloud/web/pull/7309): Keyboard shortcut indicators in ContextMenu + * Enhancement [owncloud/web#7309](https://github.com/owncloud/web/pull/7309): Lowlight cut resources + * Enhancement [owncloud/web#7133](https://github.com/owncloud/web/pull/7133): Permissionless (internal) link shares + * Enhancement [owncloud/web#7309](https://github.com/owncloud/web/pull/7309): Replace locationpicker with clipboard actions + * Enhancement [owncloud/web#7363](https://github.com/owncloud/web/pull/7363): Streamline UI sizings + * Enhancement [owncloud/web#7355](https://github.com/owncloud/web/pull/7355): Update ODS to v14.0.0-alpha.16 + * Enhancement [owncloud/web#7476](https://github.com/owncloud/web/pull/7476): Users table on small screen + * Enhancement [owncloud/web#7182](https://github.com/owncloud/web/pull/7182): User management app edit quota + + https://github.com/owncloud/ocis/pull/4439 + https://github.com/owncloud/web/releases/tag/v5.7.0-rc.10 # Changelog for [2.0.0-beta.6] (2022-08-11) The following sections list the changes for 2.0.0-beta.6. diff --git a/changelog/unreleased/bugfix-app-registry-default-mimetypes.md b/changelog/unreleased/bugfix-app-registry-default-mimetypes.md new file mode 100644 index 00000000000..4d51f871332 --- /dev/null +++ b/changelog/unreleased/bugfix-app-registry-default-mimetypes.md @@ -0,0 +1,8 @@ +Bugfix: Fix configuration of mimetypes for the app registry + +We've fixed the configuration option for mimetypes in the app registry. +Previously the default config would always be merged over the user provided +configuration. Now the default mimetype configuration is only used if the user does not +providy any mimetype configuration (like it is already done in the proxy with the routes configuration). + +https://github.com/owncloud/ocis/pull/4411 diff --git a/changelog/unreleased/bugfix-help-config-newline.md b/changelog/unreleased/bugfix-help-config-newline.md new file mode 100644 index 00000000000..1470de3e56d --- /dev/null +++ b/changelog/unreleased/bugfix-help-config-newline.md @@ -0,0 +1,6 @@ +Bugfix: Show help for some commands when unconfigured + +We've fixed some commands to show the help also when oCIS is not yet configured. +Previously the help was not displayed to the user but instead a configuration validation error. + +https://github.com/owncloud/ocis/pull/4405 diff --git a/changelog/unreleased/bugfix-idp-init-certificate-empty-file b/changelog/unreleased/bugfix-idp-init-certificate-empty-file.md similarity index 100% rename from changelog/unreleased/bugfix-idp-init-certificate-empty-file rename to changelog/unreleased/bugfix-idp-init-certificate-empty-file.md diff --git a/changelog/unreleased/bugfix-rename-extensions-to-services.md b/changelog/unreleased/bugfix-rename-extensions-to-services.md new file mode 100644 index 00000000000..fb38688caea --- /dev/null +++ b/changelog/unreleased/bugfix-rename-extensions-to-services.md @@ -0,0 +1,6 @@ +Bugfix: Rename extensions to services (leftover occurences) + +We've already renamed extensions to services in previous PRs and this +PR peforms this rename for leftover occurences. + +https://github.com/owncloud/ocis/pull/4407 diff --git a/changelog/unreleased/enhancement-mail-authentication-encryption-settings.md b/changelog/unreleased/enhancement-mail-authentication-encryption-settings.md new file mode 100644 index 00000000000..1148c126aa8 --- /dev/null +++ b/changelog/unreleased/enhancement-mail-authentication-encryption-settings.md @@ -0,0 +1,10 @@ +Enhancement: Add configuration options for mail authentication and encryption + +We've added configuration options to configure the authentication and encryption +for sending mails in the notifications service. + +Furthermore there is now a distinguished configuration option for the username to use +for authentication against the mail server. This allows you to customize the sender address +to your liking. For example sender addresses like `my oCIS instance ` are now possible, too. + +https://github.com/owncloud/ocis/pull/4443 diff --git a/changelog/unreleased/rewrite-authentication.md b/changelog/unreleased/rewrite-authentication.md new file mode 100644 index 00000000000..c3990743129 --- /dev/null +++ b/changelog/unreleased/rewrite-authentication.md @@ -0,0 +1,7 @@ +Enhancement: Rewrite of the request authentication middleware + +There were some flaws in the authentication middleware which were resolved by this rewrite. +This rewrite also introduced the need to manually mark certain paths as "unprotected" if +requests to these paths must not be authenticated. + +https://github.com/owncloud/ocis/pull/4374 diff --git a/changelog/unreleased/update-reva-beta.7.md b/changelog/unreleased/update-reva-beta.7.md index b81c362c0e4..2f7039eca3b 100644 --- a/changelog/unreleased/update-reva-beta.7.md +++ b/changelog/unreleased/update-reva-beta.7.md @@ -1,7 +1,14 @@ -Enhancement: update reva to vx.x.x +Enhancement: update reva to v2.8.0 -Updated reva to version x.x.x. This update includes: +Updated reva to version 2.8.0. This update includes: -* TODO: +* Bugfix [cs3org/reva#3158](https://github.com/cs3org/reva/pull/3158): Add name to the propfind response +* Bugfix [cs3org/reva#3157](https://github.com/cs3org/reva/pull/3157): Fix locking response codes +* Bugfix [cs3org/reva#3152](https://github.com/cs3org/reva/pull/3152): Disable caching of not found stat responses +* Bugfix [cs3org/reva#4251](https://github.com/cs3org/reva/pull/4251): Disable caching +* Enhancement [cs3org/reva#3154](https://github.com/cs3org/reva/pull/3154): Dataproviders now return file metadata +* Enhancement [cs3org/reva#3143](https://github.com/cs3org/reva/pull/3143): Add /app/open-with-web endpoint +* Enhancement [cs3org/reva#3156](https://github.com/cs3org/reva/pull/3156): Added language option to the app provider +* Enhancement [cs3org/reva#3148](https://github.com/cs3org/reva/pull/3148): Add new jsoncs3 share manager -https://github.com/owncloud/ocis/pull/4376 +https://github.com/owncloud/ocis/pull/4444 diff --git a/changelog/unreleased/update-web-beta.7.md b/changelog/unreleased/update-web-beta.7.md new file mode 100644 index 00000000000..47f3991c1c9 --- /dev/null +++ b/changelog/unreleased/update-web-beta.7.md @@ -0,0 +1,31 @@ +Enhancement: Update ownCloud Web to v5.7.0-rc.10 + +Tags: web + +We updated ownCloud Web to v5.7.0-rc.10. Please refer to the changelog (linked) for details on the web release. + +* Bugfix [owncloud/web#7443](https://github.com/owncloud/web/pull/7443): Datetime formatting +* Bugfix [owncloud/web#7437](https://github.com/owncloud/web/pull/7437): Default to user context +* Bugfix [owncloud/web#7473](https://github.com/owncloud/web/pull/7473): Dragging a file causes no selection +* Bugfix [owncloud/web#7469](https://github.com/owncloud/web/pull/7469): File size not updated while restoring file version +* Bugfix [owncloud/web#7443](https://github.com/owncloud/web/pull/7443): File size formatting +* Bugfix [owncloud/web#7474](https://github.com/owncloud/web/pull/7474): Load only supported thumbnails (configurable) +* Bugfix [owncloud/web#7309](https://github.com/owncloud/web/pull/7309): SidebarNavItem icon flickering +* Bugfix [owncloud/web#7425](https://github.com/owncloud/web/pull/7425): Open Folder in project space context menu +* Bugfix [owncloud/web#7486](https://github.com/owncloud/web/issues/7486): Prevent unnecessary PROPFIND request during upload +* Bugfix [owncloud/web#7415](https://github.com/owncloud/web/pull/7415): Re-fetch quota +* Bugfix [owncloud/web#7478](https://github.com/owncloud/web/issues/7478): "Shared via"-indicator for links +* Bugfix [owncloud/web#7480](https://github.com/owncloud/web/issues/7480): Missing space image in sidebar +* Bugfix [owncloud/web#7436](https://github.com/owncloud/web/issues/7436): Hide share actions for space viewers/editors +* Bugfix [owncloud/web#7445](https://github.com/owncloud/web/pull/7445): User management app close side bar throws error +* Enhancement [owncloud/web#7309](https://github.com/owncloud/web/pull/7309): Keyboard shortcut indicators in ContextMenu +* Enhancement [owncloud/web#7309](https://github.com/owncloud/web/pull/7309): Lowlight cut resources +* Enhancement [owncloud/web#7133](https://github.com/owncloud/web/pull/7133): Permissionless (internal) link shares +* Enhancement [owncloud/web#7309](https://github.com/owncloud/web/pull/7309): Replace locationpicker with clipboard actions +* Enhancement [owncloud/web#7363](https://github.com/owncloud/web/pull/7363): Streamline UI sizings +* Enhancement [owncloud/web#7355](https://github.com/owncloud/web/pull/7355): Update ODS to v14.0.0-alpha.16 +* Enhancement [owncloud/web#7476](https://github.com/owncloud/web/pull/7476): Users table on small screen +* Enhancement [owncloud/web#7182](https://github.com/owncloud/web/pull/7182): User management app edit quota + +https://github.com/owncloud/ocis/pull/4439 +https://github.com/owncloud/web/releases/tag/v5.7.0-rc.10 diff --git a/deployments/examples/ocis_traefik/docker-compose.yml b/deployments/examples/ocis_traefik/docker-compose.yml index 38e14059471..1b37ca17aa2 100644 --- a/deployments/examples/ocis_traefik/docker-compose.yml +++ b/deployments/examples/ocis_traefik/docker-compose.yml @@ -68,7 +68,8 @@ services: # email server (in this case inbucket acts as mail catcher) NOTIFICATIONS_SMTP_HOST: inbucket NOTIFICATIONS_SMTP_PORT: 2500 - NOTIFICATIONS_SMTP_SENDER: notifications@${OCIS_DOMAIN:-ocis.owncloud.test} + NOTIFICATIONS_SMTP_SENDER: oCIS notifications + NOTIFICATIONS_SMTP_USERNAME: notifications@${OCIS_DOMAIN:-ocis.owncloud.test} NOTIFICATIONS_SMTP_INSECURE: true # the mail catcher uses self signed certificates volumes: - ocis-config:/etc/ocis diff --git a/docs/services/app-registry/apps.md b/docs/services/app-registry/apps.md index 457e2294fb1..a6185c67145 100644 --- a/docs/services/app-registry/apps.md +++ b/docs/services/app-registry/apps.md @@ -200,9 +200,9 @@ HTTP status code: 200 **Request examples**: ```bash -curl -X POST 'https://ocis.test/app/open?file_id=ZmlsZTppZAo=' +curl -X POST 'https://ocis.test/app/open-with-web?file_id=ZmlsZTppZAo=' -curl -X POST 'https://ocis.test/app/open?file_id=ZmlsZTppZAo=&app_name=Collabora' +curl -X POST 'https://ocis.test/app/open-with-web?file_id=ZmlsZTppZAo=&app_name=Collabora' ``` **Response examples**: diff --git a/go.mod b/go.mod index fabc1ea8258..3a0db403c64 100644 --- a/go.mod +++ b/go.mod @@ -5,13 +5,13 @@ go 1.18 require ( github.com/CiscoM31/godata v1.0.5 github.com/Masterminds/semver v1.5.0 - github.com/MicahParks/keyfunc v1.2.0 + github.com/MicahParks/keyfunc v1.2.2 github.com/ReneKroon/ttlcache/v2 v2.11.0 github.com/bbalet/stopwords v1.0.0 github.com/blevesearch/bleve/v2 v2.3.3 github.com/coreos/go-oidc/v3 v3.2.0 - github.com/cs3org/go-cs3apis v0.0.0-20220719130120-361e9f987d64 - github.com/cs3org/reva/v2 v2.7.5-0.20220818115656-164699f71ceb + github.com/cs3org/go-cs3apis v0.0.0-20220818202316-e92afdddac6d + github.com/cs3org/reva/v2 v2.8.1-0.20220824102334-b4d7245016f3 github.com/disintegration/imaging v1.6.2 github.com/ggwhite/go-masker v1.0.9 github.com/go-chi/chi/v5 v5.0.7 @@ -62,9 +62,9 @@ require ( github.com/test-go/testify v1.1.4 github.com/thejerf/suture/v4 v4.0.2 github.com/tus/tusd v1.9.0 - github.com/urfave/cli/v2 v2.11.1 + github.com/urfave/cli/v2 v2.11.2 github.com/xhit/go-simple-mail/v2 v2.11.0 - go-micro.dev/v4 v4.8.0 + go-micro.dev/v4 v4.8.1 go.etcd.io/bbolt v1.3.6 go.opencensus.io v0.23.0 go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.34.0 @@ -78,6 +78,7 @@ require ( golang.org/x/net v0.0.0-20220624214902-1bab6f366d9e golang.org/x/oauth2 v0.0.0-20220722155238-128564f6959c golang.org/x/term v0.0.0-20220722155259-a9ba230a4035 + golang.org/x/text v0.3.7 google.golang.org/genproto v0.0.0-20220805133916-01dd62135a58 google.golang.org/grpc v1.48.0 google.golang.org/protobuf v1.28.1 @@ -270,7 +271,6 @@ require ( golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3 // indirect golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 // indirect golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f // indirect - golang.org/x/text v0.3.7 // indirect golang.org/x/time v0.0.0-20220224211638-0e9765cccd65 // indirect golang.org/x/tools v0.1.10 // indirect golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect diff --git a/go.sum b/go.sum index 8524411e532..cab2c4d9ec5 100644 --- a/go.sum +++ b/go.sum @@ -99,8 +99,8 @@ github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3Q github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= github.com/Masterminds/sprig v2.22.0+incompatible h1:z4yfnGrZ7netVz+0EDJ0Wi+5VZCSYp4Z0m2dk6cEM60= github.com/Masterminds/sprig v2.22.0+incompatible/go.mod h1:y6hNFY5UBTIWBxnzTeuNhlNS5hqE0NB0E6fgfo2Br3o= -github.com/MicahParks/keyfunc v1.2.0 h1:qiUfvtvvcoS0JXcHtoqglT29WyvuL0l3tkBlzp0QmsU= -github.com/MicahParks/keyfunc v1.2.0/go.mod h1:a4yfunv77gZ0RgTNw7tOYS+bjtHk5565e+1dPz+YJI8= +github.com/MicahParks/keyfunc v1.2.2 h1:MtA/6bnmhcyDMarVF9QRQmfKg1ssKxH1C+k3Gw8DY1g= +github.com/MicahParks/keyfunc v1.2.2/go.mod h1:GWZYIBflWXRPShQPMFRrUg+8buvyD0IWeg3Fi2rcrME= github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA= github.com/Microsoft/go-winio v0.4.16/go.mod h1:XB6nPKklQyQ7GC9LdcBEcBl8PF76WugXOPRXwdLnMv0= github.com/Microsoft/go-winio v0.5.0/go.mod h1:JPGBdM1cNvN/6ISo+n8V5iA4v8pBzdOpzfwIujj1a84= @@ -291,10 +291,10 @@ github.com/crewjam/httperr v0.2.0 h1:b2BfXR8U3AlIHwNeFFvZ+BV1LFvKLlzMjzaTnZMybNo github.com/crewjam/httperr v0.2.0/go.mod h1:Jlz+Sg/XqBQhyMjdDiC+GNNRzZTD7x39Gu3pglZ5oH4= github.com/crewjam/saml v0.4.6 h1:XCUFPkQSJLvzyl4cW9OvpWUbRf0gE7VUpU8ZnilbeM4= github.com/crewjam/saml v0.4.6/go.mod h1:ZBOXnNPFzB3CgOkRm7Nd6IVdkG+l/wF+0ZXLqD96t1A= -github.com/cs3org/go-cs3apis v0.0.0-20220719130120-361e9f987d64 h1:cFnankJOCWndnOns4sKRG7yzH61ammK2Am6rEGWCK40= -github.com/cs3org/go-cs3apis v0.0.0-20220719130120-361e9f987d64/go.mod h1:UXha4TguuB52H14EMoSsCqDj7k8a/t7g4gVP+bgY5LY= -github.com/cs3org/reva/v2 v2.7.5-0.20220818115656-164699f71ceb h1:yRbu+LAJbxHnzhzH13Sv5oMlsGixMGLxnXr3LjXd9uU= -github.com/cs3org/reva/v2 v2.7.5-0.20220818115656-164699f71ceb/go.mod h1:79CY/x0samKw7azYn2gzTFv0jvr2WO4JTKZwCb/+SEU= +github.com/cs3org/go-cs3apis v0.0.0-20220818202316-e92afdddac6d h1:toyZ7IsXlUdEPZ/IG8fg7hbM8HcLPY0bkX4FKBmgLVI= +github.com/cs3org/go-cs3apis v0.0.0-20220818202316-e92afdddac6d/go.mod h1:UXha4TguuB52H14EMoSsCqDj7k8a/t7g4gVP+bgY5LY= +github.com/cs3org/reva/v2 v2.8.1-0.20220824102334-b4d7245016f3 h1:Du36Xavn8tPFNqK6+3yF6u9QJXG4mtTUPWwJBPH4R7E= +github.com/cs3org/reva/v2 v2.8.1-0.20220824102334-b4d7245016f3/go.mod h1:3KTFWS3y4SjaQ5RpRQcVxKmY98Sb/E//Qgw+AFx5GfM= github.com/cubewise-code/go-mime v0.0.0-20200519001935-8c5762b177d8 h1:Z9lwXumT5ACSmJ7WGnFl+OMLLjpz5uR2fyz7dC255FI= github.com/cubewise-code/go-mime v0.0.0-20200519001935-8c5762b177d8/go.mod h1:4abs/jPXcmJzYoYGF91JF9Uq9s/KL5n1jvFDix8KcqY= github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4= @@ -1187,8 +1187,8 @@ github.com/uber-go/atomic v1.3.2/go.mod h1:/Ct5t2lcmbJ4OSe/waGBoaVvVqtO0bmtfVNex github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= github.com/urfave/cli v1.22.4/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI= -github.com/urfave/cli/v2 v2.11.1 h1:UKK6SP7fV3eKOefbS87iT9YHefv7iB/53ih6e+GNAsE= -github.com/urfave/cli/v2 v2.11.1/go.mod h1:f8iq5LtQ/bLxafbdBSLPPNsgaW0l/2fYYEHhAyPlwvo= +github.com/urfave/cli/v2 v2.11.2 h1:FVfNg4m3vbjbBpLYxW//WjxUoHvJ9TlppXcqY9Q9ZfA= +github.com/urfave/cli/v2 v2.11.2/go.mod h1:f8iq5LtQ/bLxafbdBSLPPNsgaW0l/2fYYEHhAyPlwvo= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8= github.com/valyala/fasttemplate v1.1.0/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8= @@ -1230,8 +1230,8 @@ github.com/zclconf/go-cty v1.2.0/go.mod h1:hOPWgoHbaTUnI5k4D2ld+GRpFJSCe6bCM7m1q github.com/zclconf/go-cty v1.8.0/go.mod h1:vVKLxnk3puL4qRAv72AO+W99LUD4da90g3uUAzyuvAk= github.com/zclconf/go-cty-debug v0.0.0-20191215020915-b22d67c1ba0b/go.mod h1:ZRKQfBXbGkpdV6QMzT3rU1kSTAnfu1dO8dPKjYprgj8= github.com/zenazn/goji v1.0.1/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q= -go-micro.dev/v4 v4.8.0 h1:4rrKpGHUTnrD2k2eVUVayJgWDoFlDcB/Ijkga8dZMNc= -go-micro.dev/v4 v4.8.0/go.mod h1:Ju8HrZ5hQSF+QguZ2QUs9Kbe42MHP1tJa/fpP5g07Cs= +go-micro.dev/v4 v4.8.1 h1:6/3YtUQ+ofkMJh98lC8TkpuMGoFS8kVcj0cnkQhzwDY= +go-micro.dev/v4 v4.8.1/go.mod h1:Ju8HrZ5hQSF+QguZ2QUs9Kbe42MHP1tJa/fpP5g07Cs= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= go.etcd.io/bbolt v1.3.6 h1:/ecaJf0sk1l4l6V4awd65v2C3ILy7MSj+s/x1ADCIMU= diff --git a/ocis-pkg/config/config.go b/ocis-pkg/config/config.go index a86445e6043..4739349763d 100644 --- a/ocis-pkg/config/config.go +++ b/ocis-pkg/config/config.go @@ -49,10 +49,10 @@ type Mode int // Runtime configures the oCIS runtime when running in supervised mode. type Runtime struct { - Port string `yaml:"port" env:"OCIS_RUNTIME_PORT"` - Host string `yaml:"host" env:"OCIS_RUNTIME_HOST"` - Extensions string `yaml:"services" env:"OCIS_RUN_EXTENSIONS;OCIS_RUN_SERVICES" desc:"Expects a comma separated list of service names. Will start only the listed services."` - Disabled string `yaml:"disabled_services" env:"OCIS_EXCLUDE_RUN_SERVICES" desc:"Expects a comma separated list of service names. Will start all services except of the ones listed. Has no effect when OCIS_RUN_SERVICES is set."` + Port string `yaml:"port" env:"OCIS_RUNTIME_PORT"` + Host string `yaml:"host" env:"OCIS_RUNTIME_HOST"` + Services string `yaml:"services" env:"OCIS_RUN_EXTENSIONS;OCIS_RUN_SERVICES" desc:"Expects a comma separated list of service names. Will start only the listed services."` + Disabled string `yaml:"disabled_services" env:"OCIS_EXCLUDE_RUN_SERVICES" desc:"Expects a comma separated list of service names. Will start all services except of the ones listed. Has no effect when OCIS_RUN_SERVICES is set."` } // Config combines all available configuration parts. diff --git a/ocis-pkg/config/configlog/log.go b/ocis-pkg/config/configlog/log.go new file mode 100644 index 00000000000..33079e846db --- /dev/null +++ b/ocis-pkg/config/configlog/log.go @@ -0,0 +1,30 @@ +package configlog + +import ( + "fmt" + "os" +) + +// Error logs the error +func Error(err error) { + if err != nil { + fmt.Printf("%v\n", err) + } +} + +// ReturnError logs the error and returns it unchanged +func ReturnError(err error) error { + if err != nil { + fmt.Printf("%v\n", err) + } + return err +} + +// ReturnFatal logs the error and calls os.Exit(1) and returns nil if no error is passed +func ReturnFatal(err error) error { + if err != nil { + fmt.Printf("%v\n", err) + os.Exit(1) + } + return nil +} diff --git a/ocis-pkg/config/helpers.go b/ocis-pkg/config/helpers.go index df4ec4437f3..7b72333e92b 100644 --- a/ocis-pkg/config/helpers.go +++ b/ocis-pkg/config/helpers.go @@ -17,14 +17,14 @@ var ( // BindSourcesToStructs assigns any config value from a config file / env variable to struct `dst`. Its only purpose // is to solely modify `dst`, not dealing with the config structs; and do so in a thread safe manner. -func BindSourcesToStructs(extension string, dst interface{}) (*gofig.Config, error) { - cnf := gofig.NewWithOptions(extension) +func BindSourcesToStructs(service string, dst interface{}) (*gofig.Config, error) { + cnf := gofig.NewWithOptions(service) cnf.WithOptions(func(options *gofig.Options) { options.DecoderConfig.TagName = decoderConfigTagName }) cnf.AddDriver(gooyaml.Driver) - cfgFile := path.Join(defaults.BaseConfigPath(), extension+".yaml") + cfgFile := path.Join(defaults.BaseConfigPath(), service+".yaml") _ = cnf.LoadFiles([]string{cfgFile}...) err := cnf.BindStruct("", &dst) diff --git a/ocis-pkg/config/parser/parse.go b/ocis-pkg/config/parser/parse.go index 0354b222b0f..81e1ede7b24 100644 --- a/ocis-pkg/config/parser/parse.go +++ b/ocis-pkg/config/parser/parse.go @@ -10,7 +10,7 @@ import ( // ParseConfig loads the ocis configuration and // copies applicable parts into the commons part, from -// where the extensions can copy it into their own config +// where the services can copy it into their own config func ParseConfig(cfg *config.Config, skipValidate bool) error { _, err := config.BindSourcesToStructs("ocis", cfg) if err != nil { @@ -37,7 +37,7 @@ func ParseConfig(cfg *config.Config, skipValidate bool) error { } // EnsureDefaults, ensures that all pointers in the -// oCIS config (not the extensions configs) are initialized +// oCIS config (not the services configs) are initialized func EnsureDefaults(cfg *config.Config) { if cfg.Tracing == nil { cfg.Tracing = &shared.Tracing{} diff --git a/ocis-pkg/flags/overrides.go b/ocis-pkg/flags/overrides.go index f641cf00bed..d65e815d078 100644 --- a/ocis-pkg/flags/overrides.go +++ b/ocis-pkg/flags/overrides.go @@ -2,7 +2,7 @@ package flags // OverrideDefaultString checks whether the default value of v is the zero value, if so, ensure the flag has a correct // value by providing one. A value different than zero would mean that it was read from a config file either from an -// extension or from a higher source (i.e: ocis command). +// service or from a higher source (i.e: ocis command). func OverrideDefaultString(v, def string) string { if v != "" { return v @@ -13,7 +13,7 @@ func OverrideDefaultString(v, def string) string { // OverrideDefaultBool checks whether the default value of v is the zero value, if so, ensure the flag has a correct // value by providing one. A value different than zero would mean that it was read from a config file either from an -// extension or from a higher source (i.e: ocis command). +// service or from a higher source (i.e: ocis command). func OverrideDefaultBool(v, def bool) bool { if v { return v @@ -24,7 +24,7 @@ func OverrideDefaultBool(v, def bool) bool { // OverrideDefaultInt checks whether the default value of v is the zero value, if so, ensure the flag has a correct // value by providing one. A value different than zero would mean that it was read from a config file either from an -// extension or from a higher source (i.e: ocis command). +// service or from a higher source (i.e: ocis command). func OverrideDefaultInt(v, def int) int { if v != 0 { return v @@ -35,7 +35,7 @@ func OverrideDefaultInt(v, def int) int { // OverrideDefaultInt64 checks whether the default value of v is the zero value, if so, ensure the flag has a correct // value by providing one. A value different than zero would mean that it was read from a config file either from an -// extension or from a higher source (i.e: ocis command). +// service or from a higher source (i.e: ocis command). func OverrideDefaultInt64(v, def int64) int64 { if v != 0 { return v @@ -46,7 +46,7 @@ func OverrideDefaultInt64(v, def int64) int64 { // OverrideDefaultUint64 checks whether the default value of v is the zero value, if so, ensure the flag has a correct // value by providing one. A value different than zero would mean that it was read from a config file either from an -// extension or from a higher source (i.e: ocis command). +// service or from a higher source (i.e: ocis command). func OverrideDefaultUint64(v, def uint64) uint64 { if v != 0 { return v diff --git a/ocis-pkg/shared/shared_types.go b/ocis-pkg/shared/shared_types.go index 942ab0a20dc..d633f79bfe6 100644 --- a/ocis-pkg/shared/shared_types.go +++ b/ocis-pkg/shared/shared_types.go @@ -34,7 +34,7 @@ type Reva struct { Address string `yaml:"address" env:"REVA_GATEWAY" desc:"The CS3 gateway endpoint."` } -// Commons holds configuration that are common to all extensions. Each extension can then decide whether +// Commons holds configuration that are common to all services. Each service can then decide whether // to overwrite its values. type Commons struct { Log *Log `yaml:"log"` diff --git a/ocis/pkg/command/app-provider.go b/ocis/pkg/command/app-provider.go index 89120bd57f3..50f20ce7665 100644 --- a/ocis/pkg/command/app-provider.go +++ b/ocis/pkg/command/app-provider.go @@ -1,9 +1,8 @@ package command import ( - "fmt" - "github.com/owncloud/ocis/v2/ocis-pkg/config" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/ocis-pkg/config/parser" "github.com/owncloud/ocis/v2/ocis/pkg/command/helper" "github.com/owncloud/ocis/v2/ocis/pkg/register" @@ -18,9 +17,7 @@ func AppProviderCommand(cfg *config.Config) *cli.Command { Usage: helper.SubcommandDescription(cfg.AppProvider.Service.Name), Category: "services", Before: func(c *cli.Context) error { - if err := parser.ParseConfig(cfg, true); err != nil { - fmt.Printf("%v", err) - } + configlog.Error(parser.ParseConfig(cfg, true)) cfg.AppProvider.Commons = cfg.Commons return nil }, diff --git a/ocis/pkg/command/app-registry.go b/ocis/pkg/command/app-registry.go index b16df293a80..d35fcabb424 100644 --- a/ocis/pkg/command/app-registry.go +++ b/ocis/pkg/command/app-registry.go @@ -1,9 +1,8 @@ package command import ( - "fmt" - "github.com/owncloud/ocis/v2/ocis-pkg/config" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/ocis-pkg/config/parser" "github.com/owncloud/ocis/v2/ocis/pkg/command/helper" "github.com/owncloud/ocis/v2/ocis/pkg/register" @@ -18,9 +17,7 @@ func AppRegistryCommand(cfg *config.Config) *cli.Command { Usage: helper.SubcommandDescription(cfg.AppRegistry.Service.Name), Category: "services", Before: func(c *cli.Context) error { - if err := parser.ParseConfig(cfg, true); err != nil { - fmt.Printf("%v", err) - } + configlog.Error(parser.ParseConfig(cfg, true)) cfg.AppRegistry.Commons = cfg.Commons return nil }, diff --git a/ocis/pkg/command/audit.go b/ocis/pkg/command/audit.go index 58b4d4e0a67..7299a71a847 100644 --- a/ocis/pkg/command/audit.go +++ b/ocis/pkg/command/audit.go @@ -1,9 +1,8 @@ package command import ( - "fmt" - "github.com/owncloud/ocis/v2/ocis-pkg/config" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/ocis-pkg/config/parser" "github.com/owncloud/ocis/v2/ocis/pkg/command/helper" "github.com/owncloud/ocis/v2/ocis/pkg/register" @@ -18,9 +17,7 @@ func AuditCommand(cfg *config.Config) *cli.Command { Usage: helper.SubcommandDescription(cfg.Audit.Service.Name), Category: "services", Before: func(c *cli.Context) error { - if err := parser.ParseConfig(cfg, true); err != nil { - fmt.Printf("%v", err) - } + configlog.Error(parser.ParseConfig(cfg, true)) cfg.Audit.Commons = cfg.Commons return nil }, diff --git a/ocis/pkg/command/auth-basic.go b/ocis/pkg/command/auth-basic.go index 3a850faa67a..48a026647c1 100644 --- a/ocis/pkg/command/auth-basic.go +++ b/ocis/pkg/command/auth-basic.go @@ -1,9 +1,8 @@ package command import ( - "fmt" - "github.com/owncloud/ocis/v2/ocis-pkg/config" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/ocis-pkg/config/parser" "github.com/owncloud/ocis/v2/ocis/pkg/command/helper" "github.com/owncloud/ocis/v2/ocis/pkg/register" @@ -18,9 +17,7 @@ func AuthBasicCommand(cfg *config.Config) *cli.Command { Usage: helper.SubcommandDescription(cfg.AuthBasic.Service.Name), Category: "services", Before: func(c *cli.Context) error { - if err := parser.ParseConfig(cfg, true); err != nil { - fmt.Printf("%v", err) - } + configlog.Error(parser.ParseConfig(cfg, true)) cfg.AuthBasic.Commons = cfg.Commons return nil }, diff --git a/ocis/pkg/command/auth-bearer.go b/ocis/pkg/command/auth-bearer.go index be1e3605039..413e15e9efb 100644 --- a/ocis/pkg/command/auth-bearer.go +++ b/ocis/pkg/command/auth-bearer.go @@ -1,9 +1,8 @@ package command import ( - "fmt" - "github.com/owncloud/ocis/v2/ocis-pkg/config" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/ocis-pkg/config/parser" "github.com/owncloud/ocis/v2/ocis/pkg/command/helper" "github.com/owncloud/ocis/v2/ocis/pkg/register" @@ -18,9 +17,7 @@ func AuthBearerCommand(cfg *config.Config) *cli.Command { Usage: helper.SubcommandDescription(cfg.AuthBearer.Service.Name), Category: "services", Before: func(c *cli.Context) error { - if err := parser.ParseConfig(cfg, true); err != nil { - fmt.Printf("%v", err) - } + configlog.Error(parser.ParseConfig(cfg, true)) cfg.AuthBearer.Commons = cfg.Commons return nil }, diff --git a/ocis/pkg/command/auth-machine.go b/ocis/pkg/command/auth-machine.go index 336823efab2..17c23b632f6 100644 --- a/ocis/pkg/command/auth-machine.go +++ b/ocis/pkg/command/auth-machine.go @@ -1,9 +1,8 @@ package command import ( - "fmt" - "github.com/owncloud/ocis/v2/ocis-pkg/config" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/ocis-pkg/config/parser" "github.com/owncloud/ocis/v2/ocis/pkg/command/helper" "github.com/owncloud/ocis/v2/ocis/pkg/register" @@ -18,9 +17,7 @@ func AuthMachineCommand(cfg *config.Config) *cli.Command { Usage: helper.SubcommandDescription(cfg.AuthMachine.Service.Name), Category: "services", Before: func(c *cli.Context) error { - if err := parser.ParseConfig(cfg, true); err != nil { - fmt.Printf("%v", err) - } + configlog.Error(parser.ParseConfig(cfg, true)) cfg.AuthMachine.Commons = cfg.Commons return nil }, diff --git a/ocis/pkg/command/frontend.go b/ocis/pkg/command/frontend.go index 741e96cdce7..ae28f410593 100644 --- a/ocis/pkg/command/frontend.go +++ b/ocis/pkg/command/frontend.go @@ -1,9 +1,8 @@ package command import ( - "fmt" - "github.com/owncloud/ocis/v2/ocis-pkg/config" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/ocis-pkg/config/parser" "github.com/owncloud/ocis/v2/ocis/pkg/command/helper" "github.com/owncloud/ocis/v2/ocis/pkg/register" @@ -18,9 +17,7 @@ func FrontendCommand(cfg *config.Config) *cli.Command { Usage: helper.SubcommandDescription(cfg.Frontend.Service.Name), Category: "services", Before: func(c *cli.Context) error { - if err := parser.ParseConfig(cfg, true); err != nil { - fmt.Printf("%v", err) - } + configlog.Error(parser.ParseConfig(cfg, true)) cfg.Frontend.Commons = cfg.Commons return nil }, diff --git a/ocis/pkg/command/gateway.go b/ocis/pkg/command/gateway.go index b771d3c9e9d..3562ffade54 100644 --- a/ocis/pkg/command/gateway.go +++ b/ocis/pkg/command/gateway.go @@ -1,9 +1,8 @@ package command import ( - "fmt" - "github.com/owncloud/ocis/v2/ocis-pkg/config" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/ocis-pkg/config/parser" "github.com/owncloud/ocis/v2/ocis/pkg/command/helper" "github.com/owncloud/ocis/v2/ocis/pkg/register" @@ -18,9 +17,7 @@ func GatewayCommand(cfg *config.Config) *cli.Command { Usage: helper.SubcommandDescription(cfg.Gateway.Service.Name), Category: "services", Before: func(c *cli.Context) error { - if err := parser.ParseConfig(cfg, true); err != nil { - fmt.Printf("%v", err) - } + configlog.Error(parser.ParseConfig(cfg, true)) cfg.Gateway.Commons = cfg.Commons return nil }, diff --git a/ocis/pkg/command/graph-explorer.go b/ocis/pkg/command/graph-explorer.go index 4c54deec1ea..87e6fe71f68 100644 --- a/ocis/pkg/command/graph-explorer.go +++ b/ocis/pkg/command/graph-explorer.go @@ -1,9 +1,8 @@ package command import ( - "fmt" - "github.com/owncloud/ocis/v2/ocis-pkg/config" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/ocis-pkg/config/parser" "github.com/owncloud/ocis/v2/ocis/pkg/command/helper" "github.com/owncloud/ocis/v2/ocis/pkg/register" @@ -18,9 +17,7 @@ func GraphExplorerCommand(cfg *config.Config) *cli.Command { Usage: helper.SubcommandDescription(cfg.GraphExplorer.Service.Name), Category: "services", Before: func(c *cli.Context) error { - if err := parser.ParseConfig(cfg, true); err != nil { - fmt.Printf("%v", err) - } + configlog.Error(parser.ParseConfig(cfg, true)) cfg.GraphExplorer.Commons = cfg.Commons return nil }, diff --git a/ocis/pkg/command/graph.go b/ocis/pkg/command/graph.go index ce0acc33e6b..4ff45e23138 100644 --- a/ocis/pkg/command/graph.go +++ b/ocis/pkg/command/graph.go @@ -1,9 +1,8 @@ package command import ( - "fmt" - "github.com/owncloud/ocis/v2/ocis-pkg/config" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/ocis-pkg/config/parser" "github.com/owncloud/ocis/v2/ocis/pkg/command/helper" "github.com/owncloud/ocis/v2/ocis/pkg/register" @@ -18,9 +17,7 @@ func GraphCommand(cfg *config.Config) *cli.Command { Usage: helper.SubcommandDescription(cfg.Graph.Service.Name), Category: "services", Before: func(c *cli.Context) error { - if err := parser.ParseConfig(cfg, true); err != nil { - fmt.Printf("%v", err) - } + configlog.Error(parser.ParseConfig(cfg, true)) cfg.Graph.Commons = cfg.Commons return nil }, diff --git a/ocis/pkg/command/groups.go b/ocis/pkg/command/groups.go index 50394348946..630f1060ee6 100644 --- a/ocis/pkg/command/groups.go +++ b/ocis/pkg/command/groups.go @@ -1,9 +1,8 @@ package command import ( - "fmt" - "github.com/owncloud/ocis/v2/ocis-pkg/config" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/ocis-pkg/config/parser" "github.com/owncloud/ocis/v2/ocis/pkg/command/helper" "github.com/owncloud/ocis/v2/ocis/pkg/register" @@ -18,9 +17,7 @@ func GroupsCommand(cfg *config.Config) *cli.Command { Usage: helper.SubcommandDescription(cfg.Groups.Service.Name), Category: "services", Before: func(c *cli.Context) error { - if err := parser.ParseConfig(cfg, true); err != nil { - fmt.Printf("%v", err) - } + configlog.Error(parser.ParseConfig(cfg, true)) cfg.Groups.Commons = cfg.Commons return nil }, diff --git a/ocis/pkg/command/helper/common.go b/ocis/pkg/command/helper/common.go index af71e93b098..1c2fdd990bb 100644 --- a/ocis/pkg/command/helper/common.go +++ b/ocis/pkg/command/helper/common.go @@ -5,5 +5,5 @@ import ( ) func SubcommandDescription(serviceName string) string { - return fmt.Sprintf("%s extension commands", serviceName) + return fmt.Sprintf("%s service commands", serviceName) } diff --git a/ocis/pkg/command/idm.go b/ocis/pkg/command/idm.go index 21862ade96a..3adc8373889 100644 --- a/ocis/pkg/command/idm.go +++ b/ocis/pkg/command/idm.go @@ -1,9 +1,8 @@ package command import ( - "fmt" - "github.com/owncloud/ocis/v2/ocis-pkg/config" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/ocis-pkg/config/parser" "github.com/owncloud/ocis/v2/ocis/pkg/command/helper" "github.com/owncloud/ocis/v2/ocis/pkg/register" @@ -18,9 +17,7 @@ func IDMCommand(cfg *config.Config) *cli.Command { Usage: helper.SubcommandDescription(cfg.IDM.Service.Name), Category: "services", Before: func(c *cli.Context) error { - if err := parser.ParseConfig(cfg, true); err != nil { - fmt.Printf("%v", err) - } + configlog.Error(parser.ParseConfig(cfg, true)) cfg.IDM.Commons = cfg.Commons return nil }, diff --git a/ocis/pkg/command/idp.go b/ocis/pkg/command/idp.go index 6b798bf4380..b8f0449c785 100644 --- a/ocis/pkg/command/idp.go +++ b/ocis/pkg/command/idp.go @@ -1,9 +1,8 @@ package command import ( - "fmt" - "github.com/owncloud/ocis/v2/ocis-pkg/config" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/ocis-pkg/config/parser" "github.com/owncloud/ocis/v2/ocis/pkg/command/helper" "github.com/owncloud/ocis/v2/ocis/pkg/register" @@ -18,9 +17,7 @@ func IDPCommand(cfg *config.Config) *cli.Command { Usage: helper.SubcommandDescription(cfg.IDP.Service.Name), Category: "services", Before: func(c *cli.Context) error { - if err := parser.ParseConfig(cfg, true); err != nil { - fmt.Printf("%v", err) - } + configlog.Error(parser.ParseConfig(cfg, true)) cfg.IDP.Commons = cfg.Commons return nil }, diff --git a/ocis/pkg/command/migrate.go b/ocis/pkg/command/migrate.go index 3f18b96ece1..985c44ba976 100644 --- a/ocis/pkg/command/migrate.go +++ b/ocis/pkg/command/migrate.go @@ -2,7 +2,6 @@ package command import ( "context" - "fmt" "os" "sync" @@ -13,6 +12,7 @@ import ( "github.com/cs3org/reva/v2/pkg/share/manager/registry" "github.com/owncloud/ocis/v2/ocis-pkg/config" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/ocis-pkg/config/parser" "github.com/owncloud/ocis/v2/ocis/pkg/register" sharing "github.com/owncloud/ocis/v2/services/sharing/pkg/config" @@ -27,21 +27,6 @@ func Migrate(cfg *config.Config) *cli.Command { Name: "migrate", Usage: "migrate data from an existing to another instance", Category: "migration", - Before: func(c *cli.Context) error { - // Parse base config - if err := parser.ParseConfig(cfg, true); err != nil { - fmt.Printf("%v", err) - return err - } - - // Parse sharing config - cfg.Sharing.Commons = cfg.Commons - if err := sharingparser.ParseConfig(cfg.Sharing); err != nil { - fmt.Printf("%v", err) - return err - } - return nil - }, Subcommands: []*cli.Command{ MigrateShares(cfg), MigratePublicShares(cfg), @@ -69,6 +54,16 @@ func MigrateShares(cfg *config.Config) *cli.Command { Usage: "Share manager to import the data into", }, }, + Before: func(c *cli.Context) error { + // Parse base config + if err := parser.ParseConfig(cfg, true); err != nil { + return configlog.ReturnError(err) + } + + // Parse sharing config + cfg.Sharing.Commons = cfg.Commons + return configlog.ReturnError(sharingparser.ParseConfig(cfg.Sharing)) + }, Action: func(c *cli.Context) error { log := zerolog.New(zerolog.ConsoleWriter{Out: os.Stderr}).With().Timestamp().Logger() ctx := log.WithContext(context.Background()) @@ -154,6 +149,16 @@ func MigratePublicShares(cfg *config.Config) *cli.Command { Usage: "Public share manager to import the data into", }, }, + Before: func(c *cli.Context) error { + // Parse base config + if err := parser.ParseConfig(cfg, true); err != nil { + return configlog.ReturnError(err) + } + + // Parse sharing config + cfg.Sharing.Commons = cfg.Commons + return configlog.ReturnError(sharingparser.ParseConfig(cfg.Sharing)) + }, Action: func(c *cli.Context) error { log := zerolog.New(zerolog.ConsoleWriter{Out: os.Stderr}).With().Timestamp().Logger() ctx := log.WithContext(context.Background()) diff --git a/ocis/pkg/command/nats.go b/ocis/pkg/command/nats.go index e8c60061ed0..989286c0aea 100644 --- a/ocis/pkg/command/nats.go +++ b/ocis/pkg/command/nats.go @@ -1,9 +1,8 @@ package command import ( - "fmt" - "github.com/owncloud/ocis/v2/ocis-pkg/config" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/ocis-pkg/config/parser" "github.com/owncloud/ocis/v2/ocis/pkg/command/helper" "github.com/owncloud/ocis/v2/ocis/pkg/register" @@ -18,9 +17,7 @@ func NatsCommand(cfg *config.Config) *cli.Command { Usage: helper.SubcommandDescription(cfg.Nats.Service.Name), Category: "services", Before: func(c *cli.Context) error { - if err := parser.ParseConfig(cfg, true); err != nil { - fmt.Printf("%v", err) - } + configlog.Error(parser.ParseConfig(cfg, true)) cfg.Nats.Commons = cfg.Commons return nil }, diff --git a/ocis/pkg/command/notifications.go b/ocis/pkg/command/notifications.go index 0599dc86e88..0fc591f1460 100644 --- a/ocis/pkg/command/notifications.go +++ b/ocis/pkg/command/notifications.go @@ -1,9 +1,8 @@ package command import ( - "fmt" - "github.com/owncloud/ocis/v2/ocis-pkg/config" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/ocis-pkg/config/parser" "github.com/owncloud/ocis/v2/ocis/pkg/command/helper" "github.com/owncloud/ocis/v2/ocis/pkg/register" @@ -18,9 +17,7 @@ func NotificationsCommand(cfg *config.Config) *cli.Command { Usage: helper.SubcommandDescription(cfg.Notifications.Service.Name), Category: "services", Before: func(c *cli.Context) error { - if err := parser.ParseConfig(cfg, true); err != nil { - fmt.Printf("%v", err) - } + configlog.Error(parser.ParseConfig(cfg, true)) cfg.Notifications.Commons = cfg.Commons return nil }, diff --git a/ocis/pkg/command/ocdav.go b/ocis/pkg/command/ocdav.go index cc04d648847..a46cd3ecf56 100644 --- a/ocis/pkg/command/ocdav.go +++ b/ocis/pkg/command/ocdav.go @@ -1,9 +1,8 @@ package command import ( - "fmt" - "github.com/owncloud/ocis/v2/ocis-pkg/config" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/ocis-pkg/config/parser" "github.com/owncloud/ocis/v2/ocis/pkg/command/helper" "github.com/owncloud/ocis/v2/ocis/pkg/register" @@ -18,9 +17,7 @@ func OCDavCommand(cfg *config.Config) *cli.Command { Usage: helper.SubcommandDescription(cfg.OCDav.Service.Name), Category: "services", Before: func(c *cli.Context) error { - if err := parser.ParseConfig(cfg, true); err != nil { - fmt.Printf("%v", err) - } + configlog.Error(parser.ParseConfig(cfg, true)) cfg.OCDav.Commons = cfg.Commons return nil }, diff --git a/ocis/pkg/command/ocs.go b/ocis/pkg/command/ocs.go index abeb8310bd0..89091138c4e 100644 --- a/ocis/pkg/command/ocs.go +++ b/ocis/pkg/command/ocs.go @@ -1,9 +1,8 @@ package command import ( - "fmt" - "github.com/owncloud/ocis/v2/ocis-pkg/config" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/ocis-pkg/config/parser" "github.com/owncloud/ocis/v2/ocis/pkg/command/helper" "github.com/owncloud/ocis/v2/ocis/pkg/register" @@ -18,9 +17,7 @@ func OCSCommand(cfg *config.Config) *cli.Command { Usage: helper.SubcommandDescription(cfg.OCS.Service.Name), Category: "services", Before: func(c *cli.Context) error { - if err := parser.ParseConfig(cfg, true); err != nil { - fmt.Printf("%v", err) - } + configlog.Error(parser.ParseConfig(cfg, true)) cfg.OCS.Commons = cfg.Commons return nil }, diff --git a/ocis/pkg/command/proxy.go b/ocis/pkg/command/proxy.go index 127957bc693..0bdbf71e250 100644 --- a/ocis/pkg/command/proxy.go +++ b/ocis/pkg/command/proxy.go @@ -1,9 +1,8 @@ package command import ( - "fmt" - "github.com/owncloud/ocis/v2/ocis-pkg/config" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/ocis-pkg/config/parser" "github.com/owncloud/ocis/v2/ocis/pkg/command/helper" "github.com/owncloud/ocis/v2/ocis/pkg/register" @@ -18,9 +17,7 @@ func ProxyCommand(cfg *config.Config) *cli.Command { Usage: helper.SubcommandDescription(cfg.Proxy.Service.Name), Category: "services", Before: func(c *cli.Context) error { - if err := parser.ParseConfig(cfg, true); err != nil { - fmt.Printf("%v", err) - } + configlog.Error(parser.ParseConfig(cfg, true)) cfg.Proxy.Commons = cfg.Commons return nil }, diff --git a/ocis/pkg/command/search.go b/ocis/pkg/command/search.go index c649fbce414..59cb691e9e6 100644 --- a/ocis/pkg/command/search.go +++ b/ocis/pkg/command/search.go @@ -1,9 +1,8 @@ package command import ( - "fmt" - "github.com/owncloud/ocis/v2/ocis-pkg/config" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/ocis-pkg/config/parser" "github.com/owncloud/ocis/v2/ocis/pkg/command/helper" "github.com/owncloud/ocis/v2/ocis/pkg/register" @@ -18,9 +17,7 @@ func SearchCommand(cfg *config.Config) *cli.Command { Usage: helper.SubcommandDescription(cfg.Search.Service.Name), Category: "services", Before: func(c *cli.Context) error { - if err := parser.ParseConfig(cfg, true); err != nil { - fmt.Printf("%v", err) - } + configlog.Error(parser.ParseConfig(cfg, true)) cfg.Search.Commons = cfg.Commons return nil }, diff --git a/ocis/pkg/command/server.go b/ocis/pkg/command/server.go index c935aba9f14..a83ffd585f1 100644 --- a/ocis/pkg/command/server.go +++ b/ocis/pkg/command/server.go @@ -1,9 +1,8 @@ package command import ( - "fmt" - "github.com/owncloud/ocis/v2/ocis-pkg/config" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/ocis-pkg/config/parser" "github.com/owncloud/ocis/v2/ocis/pkg/register" "github.com/owncloud/ocis/v2/ocis/pkg/runtime" @@ -17,11 +16,7 @@ func Server(cfg *config.Config) *cli.Command { Usage: "start a fullstack server (runtime and all services in supervised mode)", Category: "fullstack", Before: func(c *cli.Context) error { - if err := parser.ParseConfig(cfg, false); err != nil { - fmt.Printf("%v", err) - return err - } - return nil + return configlog.ReturnError(parser.ParseConfig(cfg, false)) }, Action: func(c *cli.Context) error { r := runtime.New(cfg) diff --git a/ocis/pkg/command/settings.go b/ocis/pkg/command/settings.go index ec95cf3a17a..d5950b2096d 100644 --- a/ocis/pkg/command/settings.go +++ b/ocis/pkg/command/settings.go @@ -1,9 +1,8 @@ package command import ( - "fmt" - "github.com/owncloud/ocis/v2/ocis-pkg/config" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/ocis-pkg/config/parser" "github.com/owncloud/ocis/v2/ocis/pkg/command/helper" "github.com/owncloud/ocis/v2/ocis/pkg/register" @@ -18,9 +17,7 @@ func SettingsCommand(cfg *config.Config) *cli.Command { Usage: helper.SubcommandDescription(cfg.Settings.Service.Name), Category: "services", Before: func(c *cli.Context) error { - if err := parser.ParseConfig(cfg, true); err != nil { - fmt.Printf("%v", err) - } + configlog.Error(parser.ParseConfig(cfg, true)) cfg.Settings.Commons = cfg.Commons return nil }, diff --git a/ocis/pkg/command/sharing.go b/ocis/pkg/command/sharing.go index 9145f532c52..31ccc40ca2e 100644 --- a/ocis/pkg/command/sharing.go +++ b/ocis/pkg/command/sharing.go @@ -1,9 +1,8 @@ package command import ( - "fmt" - "github.com/owncloud/ocis/v2/ocis-pkg/config" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/ocis-pkg/config/parser" "github.com/owncloud/ocis/v2/ocis/pkg/command/helper" "github.com/owncloud/ocis/v2/ocis/pkg/register" @@ -18,9 +17,7 @@ func SharingCommand(cfg *config.Config) *cli.Command { Usage: helper.SubcommandDescription(cfg.Sharing.Service.Name), Category: "services", Before: func(c *cli.Context) error { - if err := parser.ParseConfig(cfg, true); err != nil { - fmt.Printf("%v", err) - } + configlog.Error(parser.ParseConfig(cfg, true)) cfg.Sharing.Commons = cfg.Commons return nil }, diff --git a/ocis/pkg/command/storage-publiclink.go b/ocis/pkg/command/storage-publiclink.go index 04780870c5c..1819089247d 100644 --- a/ocis/pkg/command/storage-publiclink.go +++ b/ocis/pkg/command/storage-publiclink.go @@ -1,9 +1,8 @@ package command import ( - "fmt" - "github.com/owncloud/ocis/v2/ocis-pkg/config" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/ocis-pkg/config/parser" "github.com/owncloud/ocis/v2/ocis/pkg/command/helper" "github.com/owncloud/ocis/v2/ocis/pkg/register" @@ -18,9 +17,7 @@ func StoragePublicLinkCommand(cfg *config.Config) *cli.Command { Usage: helper.SubcommandDescription(cfg.StoragePublicLink.Service.Name), Category: "services", Before: func(c *cli.Context) error { - if err := parser.ParseConfig(cfg, true); err != nil { - fmt.Printf("%v", err) - } + configlog.Error(parser.ParseConfig(cfg, true)) cfg.StoragePublicLink.Commons = cfg.Commons return nil }, diff --git a/ocis/pkg/command/storage-shares.go b/ocis/pkg/command/storage-shares.go index e499e008f66..6def8926965 100644 --- a/ocis/pkg/command/storage-shares.go +++ b/ocis/pkg/command/storage-shares.go @@ -1,9 +1,8 @@ package command import ( - "fmt" - "github.com/owncloud/ocis/v2/ocis-pkg/config" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/ocis-pkg/config/parser" "github.com/owncloud/ocis/v2/ocis/pkg/command/helper" "github.com/owncloud/ocis/v2/ocis/pkg/register" @@ -18,9 +17,7 @@ func StorageSharesCommand(cfg *config.Config) *cli.Command { Usage: helper.SubcommandDescription(cfg.StorageShares.Service.Name), Category: "services", Before: func(c *cli.Context) error { - if err := parser.ParseConfig(cfg, true); err != nil { - fmt.Printf("%v", err) - } + configlog.Error(parser.ParseConfig(cfg, true)) cfg.StorageShares.Commons = cfg.Commons return nil }, diff --git a/ocis/pkg/command/storage-system.go b/ocis/pkg/command/storage-system.go index e90af469073..cd933eeeaa3 100644 --- a/ocis/pkg/command/storage-system.go +++ b/ocis/pkg/command/storage-system.go @@ -1,9 +1,8 @@ package command import ( - "fmt" - "github.com/owncloud/ocis/v2/ocis-pkg/config" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/ocis-pkg/config/parser" "github.com/owncloud/ocis/v2/ocis/pkg/command/helper" "github.com/owncloud/ocis/v2/ocis/pkg/register" @@ -18,9 +17,7 @@ func StorageSystemCommand(cfg *config.Config) *cli.Command { Usage: helper.SubcommandDescription(cfg.StorageSystem.Service.Name), Category: "services", Before: func(c *cli.Context) error { - if err := parser.ParseConfig(cfg, true); err != nil { - fmt.Printf("%v", err) - } + configlog.Error(parser.ParseConfig(cfg, true)) cfg.StorageSystem.Commons = cfg.Commons return nil }, diff --git a/ocis/pkg/command/storage-users.go b/ocis/pkg/command/storage-users.go index f1598332bb7..980cc953d6f 100644 --- a/ocis/pkg/command/storage-users.go +++ b/ocis/pkg/command/storage-users.go @@ -1,9 +1,8 @@ package command import ( - "fmt" - "github.com/owncloud/ocis/v2/ocis-pkg/config" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/ocis-pkg/config/parser" "github.com/owncloud/ocis/v2/ocis/pkg/command/helper" "github.com/owncloud/ocis/v2/ocis/pkg/register" @@ -18,9 +17,7 @@ func StorageUsersCommand(cfg *config.Config) *cli.Command { Usage: helper.SubcommandDescription(cfg.StorageUsers.Service.Name), Category: "services", Before: func(c *cli.Context) error { - if err := parser.ParseConfig(cfg, true); err != nil { - fmt.Printf("%v", err) - } + configlog.Error(parser.ParseConfig(cfg, true)) cfg.StorageUsers.Commons = cfg.Commons return nil }, diff --git a/ocis/pkg/command/store.go b/ocis/pkg/command/store.go index 617af037cd8..947779d71e1 100644 --- a/ocis/pkg/command/store.go +++ b/ocis/pkg/command/store.go @@ -1,9 +1,8 @@ package command import ( - "fmt" - "github.com/owncloud/ocis/v2/ocis-pkg/config" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/ocis-pkg/config/parser" "github.com/owncloud/ocis/v2/ocis/pkg/command/helper" "github.com/owncloud/ocis/v2/ocis/pkg/register" @@ -19,9 +18,7 @@ func StoreCommand(cfg *config.Config) *cli.Command { Usage: helper.SubcommandDescription(cfg.Store.Service.Name), Category: "services", Before: func(c *cli.Context) error { - if err := parser.ParseConfig(cfg, true); err != nil { - fmt.Printf("%v", err) - } + configlog.Error(parser.ParseConfig(cfg, true)) cfg.Store.Commons = cfg.Commons return nil }, diff --git a/ocis/pkg/command/thumbnails.go b/ocis/pkg/command/thumbnails.go index da60a12a189..235edfafb37 100644 --- a/ocis/pkg/command/thumbnails.go +++ b/ocis/pkg/command/thumbnails.go @@ -1,9 +1,8 @@ package command import ( - "fmt" - "github.com/owncloud/ocis/v2/ocis-pkg/config" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/ocis-pkg/config/parser" "github.com/owncloud/ocis/v2/ocis/pkg/command/helper" "github.com/owncloud/ocis/v2/ocis/pkg/register" @@ -18,9 +17,7 @@ func ThumbnailsCommand(cfg *config.Config) *cli.Command { Usage: helper.SubcommandDescription(cfg.Thumbnails.Service.Name), Category: "services", Before: func(c *cli.Context) error { - if err := parser.ParseConfig(cfg, true); err != nil { - fmt.Printf("%v", err) - } + configlog.Error(parser.ParseConfig(cfg, true)) cfg.Thumbnails.Commons = cfg.Commons return nil }, diff --git a/ocis/pkg/command/users.go b/ocis/pkg/command/users.go index 992a0492858..905c7571875 100644 --- a/ocis/pkg/command/users.go +++ b/ocis/pkg/command/users.go @@ -1,9 +1,8 @@ package command import ( - "fmt" - "github.com/owncloud/ocis/v2/ocis-pkg/config" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/ocis-pkg/config/parser" "github.com/owncloud/ocis/v2/ocis/pkg/command/helper" "github.com/owncloud/ocis/v2/ocis/pkg/register" @@ -18,9 +17,7 @@ func UsersCommand(cfg *config.Config) *cli.Command { Usage: helper.SubcommandDescription(cfg.Users.Service.Name), Category: "services", Before: func(c *cli.Context) error { - if err := parser.ParseConfig(cfg, true); err != nil { - fmt.Printf("%v", err) - } + configlog.Error(parser.ParseConfig(cfg, true)) cfg.Users.Commons = cfg.Commons return nil }, diff --git a/ocis/pkg/command/version.go b/ocis/pkg/command/version.go index 882e6925eb3..3e251f953e8 100644 --- a/ocis/pkg/command/version.go +++ b/ocis/pkg/command/version.go @@ -17,7 +17,7 @@ import ( func VersionCommand(cfg *config.Config) *cli.Command { return &cli.Command{ Name: "version", - Usage: "print the version of this binary and all running extension instances", + Usage: "print the version of this binary and all running service instances", Category: "info", Action: func(c *cli.Context) error { fmt.Println("Version: " + version.GetString()) diff --git a/ocis/pkg/command/web.go b/ocis/pkg/command/web.go index dd826d6b998..e7b1f001df6 100644 --- a/ocis/pkg/command/web.go +++ b/ocis/pkg/command/web.go @@ -1,9 +1,8 @@ package command import ( - "fmt" - "github.com/owncloud/ocis/v2/ocis-pkg/config" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/ocis-pkg/config/parser" "github.com/owncloud/ocis/v2/ocis/pkg/command/helper" "github.com/owncloud/ocis/v2/ocis/pkg/register" @@ -18,9 +17,7 @@ func WebCommand(cfg *config.Config) *cli.Command { Usage: helper.SubcommandDescription(cfg.Web.Service.Name), Category: "services", Before: func(c *cli.Context) error { - if err := parser.ParseConfig(cfg, true); err != nil { - fmt.Printf("%v", err) - } + configlog.Error(parser.ParseConfig(cfg, true)) cfg.Web.Commons = cfg.Commons return nil }, diff --git a/ocis/pkg/command/webdav.go b/ocis/pkg/command/webdav.go index 20be56b5b0e..6acd8ec5960 100644 --- a/ocis/pkg/command/webdav.go +++ b/ocis/pkg/command/webdav.go @@ -1,9 +1,8 @@ package command import ( - "fmt" - "github.com/owncloud/ocis/v2/ocis-pkg/config" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/ocis-pkg/config/parser" "github.com/owncloud/ocis/v2/ocis/pkg/command/helper" "github.com/owncloud/ocis/v2/ocis/pkg/register" @@ -19,9 +18,7 @@ func WebDAVCommand(cfg *config.Config) *cli.Command { Usage: helper.SubcommandDescription(cfg.WebDAV.Service.Name), Category: "services", Before: func(c *cli.Context) error { - if err := parser.ParseConfig(cfg, true); err != nil { - fmt.Printf("%v", err) - } + configlog.Error(parser.ParseConfig(cfg, true)) cfg.WebDAV.Commons = cfg.Commons return nil }, diff --git a/ocis/pkg/init/init.go b/ocis/pkg/init/init.go index 733092c5c26..a700bcdee63 100644 --- a/ocis/pkg/init/init.go +++ b/ocis/pkg/init/init.go @@ -23,24 +23,24 @@ type TokenManager struct { JWTSecret string `yaml:"jwt_secret"` } -type InsecureExtension struct { +type InsecureService struct { Insecure bool } -type InsecureProxyExtension struct { +type InsecureProxyService struct { InsecureBackends bool `yaml:"insecure_backends"` } type LdapSettings struct { BindPassword string `yaml:"bind_password"` } -type LdapBasedExtension struct { +type LdapBasedService struct { Ldap LdapSettings } -type GraphExtension struct { - Spaces InsecureExtension - Identity LdapBasedExtension +type GraphService struct { + Spaces InsecureService + Identity LdapBasedService } type ServiceUserPasswordsSettings struct { @@ -49,27 +49,27 @@ type ServiceUserPasswordsSettings struct { RevaPassword string `yaml:"reva_password"` IdpPassword string `yaml:"idp_password"` } -type IdmExtension struct { +type IdmService struct { ServiceUserPasswords ServiceUserPasswordsSettings `yaml:"service_user_passwords"` } -type FrontendExtension struct { - Archiver InsecureExtension +type FrontendService struct { + Archiver InsecureService } -type AuthbasicExtension struct { - AuthProviders LdapBasedExtension `yaml:"auth_providers"` +type AuthbasicService struct { + AuthProviders LdapBasedService `yaml:"auth_providers"` } type AuthProviderSettings struct { - Oidc InsecureExtension + Oidc InsecureService } -type AuthbearerExtension struct { +type AuthbearerService struct { AuthProviders AuthProviderSettings `yaml:"auth_providers"` } -type UsersAndGroupsExtension struct { - Drivers LdapBasedExtension +type UsersAndGroupsService struct { + Drivers LdapBasedService } type ThumbnailSettings struct { @@ -78,7 +78,7 @@ type ThumbnailSettings struct { Cs3AllowInsecure bool `yaml:"cs3_allow_insecure"` } -type ThumbnailExtension struct { +type ThumbnailService struct { Thumbnail ThumbnailSettings } @@ -101,17 +101,17 @@ type OcisConfig struct { TransferSecret string `yaml:"transfer_secret"` SystemUserID string `yaml:"system_user_id"` AdminUserID string `yaml:"admin_user_id"` - Graph GraphExtension - Idp LdapBasedExtension - Idm IdmExtension - Proxy InsecureProxyExtension - Frontend FrontendExtension - AuthBasic AuthbasicExtension `yaml:"auth_basic"` - AuthBearer AuthbearerExtension `yaml:"auth_bearer"` - Users UsersAndGroupsExtension - Groups UsersAndGroupsExtension - Ocdav InsecureExtension - Thumbnails ThumbnailExtension + Graph GraphService + Idp LdapBasedService + Idm IdmService + Proxy InsecureProxyService + Frontend FrontendService + AuthBasic AuthbasicService `yaml:"auth_basic"` + AuthBearer AuthbearerService `yaml:"auth_bearer"` + Users UsersAndGroupsService + Groups UsersAndGroupsService + Ocdav InsecureService + Thumbnails ThumbnailService } func checkConfigPath(configPath string) error { @@ -213,7 +213,7 @@ func CreateConfig(insecure, forceOverwrite bool, configPath, adminPassword strin TransferSecret: revaTransferSecret, SystemUserID: systemUserID, AdminUserID: adminUserID, - Idm: IdmExtension{ + Idm: IdmService{ ServiceUserPasswords: ServiceUserPasswordsSettings{ AdminPassword: ocisAdminServicePassword, IdpPassword: idpServicePassword, @@ -221,40 +221,40 @@ func CreateConfig(insecure, forceOverwrite bool, configPath, adminPassword strin IdmPassword: idmServicePassword, }, }, - Idp: LdapBasedExtension{ + Idp: LdapBasedService{ Ldap: LdapSettings{ BindPassword: idpServicePassword, }, }, - AuthBasic: AuthbasicExtension{ - AuthProviders: LdapBasedExtension{ + AuthBasic: AuthbasicService{ + AuthProviders: LdapBasedService{ Ldap: LdapSettings{ BindPassword: revaServicePassword, }, }, }, - Groups: UsersAndGroupsExtension{ - Drivers: LdapBasedExtension{ + Groups: UsersAndGroupsService{ + Drivers: LdapBasedService{ Ldap: LdapSettings{ BindPassword: revaServicePassword, }, }, }, - Users: UsersAndGroupsExtension{ - Drivers: LdapBasedExtension{ + Users: UsersAndGroupsService{ + Drivers: LdapBasedService{ Ldap: LdapSettings{ BindPassword: revaServicePassword, }, }, }, - Graph: GraphExtension{ - Identity: LdapBasedExtension{ + Graph: GraphService{ + Identity: LdapBasedService{ Ldap: LdapSettings{ BindPassword: idmServicePassword, }, }, }, - Thumbnails: ThumbnailExtension{ + Thumbnails: ThumbnailService{ Thumbnail: ThumbnailSettings{ TransferSecret: thumbnailsTransferSecret, }, @@ -262,25 +262,25 @@ func CreateConfig(insecure, forceOverwrite bool, configPath, adminPassword strin } if insecure { - cfg.AuthBearer = AuthbearerExtension{ + cfg.AuthBearer = AuthbearerService{ AuthProviders: AuthProviderSettings{ - Oidc: InsecureExtension{ + Oidc: InsecureService{ Insecure: true, }, }, } - cfg.Frontend = FrontendExtension{ - Archiver: InsecureExtension{ + cfg.Frontend = FrontendService{ + Archiver: InsecureService{ Insecure: true, }, } - cfg.Graph.Spaces = InsecureExtension{ + cfg.Graph.Spaces = InsecureService{ Insecure: true, } - cfg.Ocdav = InsecureExtension{ + cfg.Ocdav = InsecureService{ Insecure: true, } - cfg.Proxy = InsecureProxyExtension{ + cfg.Proxy = InsecureProxyService{ InsecureBackends: true, } diff --git a/ocis/pkg/runtime/cmd/list.go b/ocis/pkg/runtime/cmd/list.go index b4d54dd299a..7f59da14d32 100644 --- a/ocis/pkg/runtime/cmd/list.go +++ b/ocis/pkg/runtime/cmd/list.go @@ -10,7 +10,7 @@ import ( "github.com/spf13/cobra" ) -// List running extensions. +// List running service. func List(cfg *config.Config) *cobra.Command { return &cobra.Command{ Use: "list", diff --git a/ocis/pkg/runtime/service/service.go b/ocis/pkg/runtime/service/service.go index 8d21a0f3962..762f256ff9b 100644 --- a/ocis/pkg/runtime/service/service.go +++ b/ocis/pkg/runtime/service/service.go @@ -55,7 +55,7 @@ import ( ) var ( - // runset keeps track of which extensions to start supervised. + // runset keeps track of which services to start supervised. runset map[string]struct{} ) @@ -142,7 +142,7 @@ func NewService(options ...Option) (*Service, error) { return s, nil } -// Start an rpc service. By default the package scope Start will run all default extensions to provide with a working +// Start an rpc service. By default the package scope Start will run all default services to provide with a working // oCIS instance. func Start(o ...Option) error { // Start the runtime. Most likely this was called ONLY by the `ocis server` subcommand, but since we cannot protect @@ -241,12 +241,12 @@ func scheduleServiceTokens(s *Service, funcSet serviceFuncMap) { } } -// generateRunSet interprets the cfg.Runtime.Extensions config option to cherry-pick which services to start using +// generateRunSet interprets the cfg.Runtime.Services config option to cherry-pick which services to start using // the runtime. func (s *Service) generateRunSet(cfg *ociscfg.Config) { runset = make(map[string]struct{}) - if cfg.Runtime.Extensions != "" { - e := strings.Split(strings.ReplaceAll(cfg.Runtime.Extensions, " ", ""), ",") + if cfg.Runtime.Services != "" { + e := strings.Split(strings.ReplaceAll(cfg.Runtime.Services, " ", ""), ",") for _, name := range e { runset[name] = struct{}{} } @@ -273,7 +273,7 @@ func (s *Service) generateRunSet(cfg *ociscfg.Config) { func (s *Service) List(_ struct{}, reply *string) error { tableString := &strings.Builder{} table := tablewriter.NewWriter(tableString) - table.SetHeader([]string{"Extension"}) + table.SetHeader([]string{"Service"}) names := []string{} for t := range s.serviceToken { diff --git a/services/app-provider/pkg/command/health.go b/services/app-provider/pkg/command/health.go index 9344b8a9acb..23db3c5011f 100644 --- a/services/app-provider/pkg/command/health.go +++ b/services/app-provider/pkg/command/health.go @@ -4,6 +4,7 @@ import ( "fmt" "net/http" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/services/app-provider/pkg/config" "github.com/owncloud/ocis/v2/services/app-provider/pkg/config/parser" "github.com/owncloud/ocis/v2/services/app-provider/pkg/logging" @@ -17,11 +18,7 @@ func Health(cfg *config.Config) *cli.Command { Usage: "check health status", Category: "info", Before: func(c *cli.Context) error { - err := parser.ParseConfig(cfg) - if err != nil { - fmt.Printf("%v", err) - } - return err + return configlog.ReturnError(parser.ParseConfig(cfg)) }, Action: func(c *cli.Context) error { logger := logging.Configure(cfg.Service.Name, cfg.Log) diff --git a/services/app-provider/pkg/command/server.go b/services/app-provider/pkg/command/server.go index 72fe31104e8..a7fc216d07e 100644 --- a/services/app-provider/pkg/command/server.go +++ b/services/app-provider/pkg/command/server.go @@ -9,6 +9,7 @@ import ( "github.com/cs3org/reva/v2/cmd/revad/runtime" "github.com/gofrs/uuid" "github.com/oklog/run" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/ocis-pkg/service/external" "github.com/owncloud/ocis/v2/ocis-pkg/sync" "github.com/owncloud/ocis/v2/ocis-pkg/version" @@ -25,15 +26,10 @@ import ( func Server(cfg *config.Config) *cli.Command { return &cli.Command{ Name: "server", - Usage: fmt.Sprintf("start %s extension without runtime (unsupervised mode)", cfg.Service.Name), + Usage: fmt.Sprintf("start the %s service without runtime (unsupervised mode)", cfg.Service.Name), Category: "server", Before: func(c *cli.Context) error { - err := parser.ParseConfig(cfg) - if err != nil { - fmt.Printf("%v", err) - os.Exit(1) - } - return err + return configlog.ReturnFatal(parser.ParseConfig(cfg)) }, Action: func(c *cli.Context) error { logger := logging.Configure(cfg.Service.Name, cfg.Log) @@ -97,7 +93,7 @@ func Server(cfg *config.Config) *cli.Command { } } -// defineContext sets the context for the extension. If there is a context configured it will create a new child from it, +// defineContext sets the context for the service. If there is a context configured it will create a new child from it, // if not, it will create a root context that can be cancelled. func defineContext(cfg *config.Config) (context.Context, context.CancelFunc) { return func() (context.Context, context.CancelFunc) { diff --git a/services/app-provider/pkg/command/version.go b/services/app-provider/pkg/command/version.go index c191fbcfffd..ee143919f57 100644 --- a/services/app-provider/pkg/command/version.go +++ b/services/app-provider/pkg/command/version.go @@ -16,7 +16,7 @@ import ( func Version(cfg *config.Config) *cli.Command { return &cli.Command{ Name: "version", - Usage: "print the version of this binary and the running extension instances", + Usage: "print the version of this binary and the running service instances", Category: "info", Action: func(c *cli.Context) error { fmt.Println("Version: " + version.GetString()) diff --git a/services/app-registry/pkg/command/health.go b/services/app-registry/pkg/command/health.go index d1227a0544c..f8331072cc5 100644 --- a/services/app-registry/pkg/command/health.go +++ b/services/app-registry/pkg/command/health.go @@ -4,6 +4,7 @@ import ( "fmt" "net/http" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/services/app-registry/pkg/config" "github.com/owncloud/ocis/v2/services/app-registry/pkg/config/parser" "github.com/owncloud/ocis/v2/services/app-registry/pkg/logging" @@ -17,11 +18,7 @@ func Health(cfg *config.Config) *cli.Command { Usage: "check health status", Category: "info", Before: func(c *cli.Context) error { - err := parser.ParseConfig(cfg) - if err != nil { - fmt.Printf("%v", err) - } - return err + return configlog.ReturnError(parser.ParseConfig(cfg)) }, Action: func(c *cli.Context) error { logger := logging.Configure(cfg.Service.Name, cfg.Log) diff --git a/services/app-registry/pkg/command/server.go b/services/app-registry/pkg/command/server.go index f09619d595a..aa230570fbe 100644 --- a/services/app-registry/pkg/command/server.go +++ b/services/app-registry/pkg/command/server.go @@ -9,6 +9,7 @@ import ( "github.com/cs3org/reva/v2/cmd/revad/runtime" "github.com/gofrs/uuid" "github.com/oklog/run" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/ocis-pkg/service/external" "github.com/owncloud/ocis/v2/ocis-pkg/version" "github.com/owncloud/ocis/v2/services/app-registry/pkg/config" @@ -24,15 +25,10 @@ import ( func Server(cfg *config.Config) *cli.Command { return &cli.Command{ Name: "server", - Usage: fmt.Sprintf("start %s extension without runtime (unsupervised mode)", cfg.Service.Name), + Usage: fmt.Sprintf("start the %s service without runtime (unsupervised mode)", cfg.Service.Name), Category: "server", Before: func(c *cli.Context) error { - err := parser.ParseConfig(cfg) - if err != nil { - fmt.Printf("%v", err) - os.Exit(1) - } - return err + return configlog.ReturnFatal(parser.ParseConfig(cfg)) }, Action: func(c *cli.Context) error { logger := logging.Configure(cfg.Service.Name, cfg.Log) @@ -92,7 +88,7 @@ func Server(cfg *config.Config) *cli.Command { } } -// defineContext sets the context for the extension. If there is a context configured it will create a new child from it, +// defineContext sets the context for the service. If there is a context configured it will create a new child from it, // if not, it will create a root context that can be cancelled. func defineContext(cfg *config.Config) (context.Context, context.CancelFunc) { return func() (context.Context, context.CancelFunc) { diff --git a/services/app-registry/pkg/command/version.go b/services/app-registry/pkg/command/version.go index 380a3086267..c4e1adc1f02 100644 --- a/services/app-registry/pkg/command/version.go +++ b/services/app-registry/pkg/command/version.go @@ -16,7 +16,7 @@ import ( func Version(cfg *config.Config) *cli.Command { return &cli.Command{ Name: "version", - Usage: "print the version of this binary and the running extension instances", + Usage: "print the version of this binary and the running service instances", Category: "info", Action: func(c *cli.Context) error { fmt.Println("Version: " + version.GetString()) diff --git a/services/app-registry/pkg/config/defaults/defaultconfig.go b/services/app-registry/pkg/config/defaults/defaultconfig.go index 4846146f98c..c754f4e5064 100644 --- a/services/app-registry/pkg/config/defaults/defaultconfig.go +++ b/services/app-registry/pkg/config/defaults/defaultconfig.go @@ -30,9 +30,6 @@ func DefaultConfig() *config.Config { Reva: &config.Reva{ Address: "127.0.0.1:9142", }, - AppRegistry: config.AppRegistry{ - MimeTypeConfig: defaultMimeTypeConfig(), - }, } } @@ -150,6 +147,9 @@ func EnsureDefaults(cfg *config.Config) { } +// Sanitize the config func Sanitize(cfg *config.Config) { - // nothing to sanitize here atm + if cfg.AppRegistry.MimeTypeConfig == nil { + cfg.AppRegistry.MimeTypeConfig = defaultMimeTypeConfig() + } } diff --git a/services/audit/pkg/command/server.go b/services/audit/pkg/command/server.go index fd904a0095d..2537adfdd57 100644 --- a/services/audit/pkg/command/server.go +++ b/services/audit/pkg/command/server.go @@ -3,11 +3,11 @@ package command import ( "context" "fmt" - "os" "github.com/cs3org/reva/v2/pkg/events" "github.com/cs3org/reva/v2/pkg/events/server" "github.com/go-micro/plugins/v4/events/natsjs" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/services/audit/pkg/config" "github.com/owncloud/ocis/v2/services/audit/pkg/config/parser" "github.com/owncloud/ocis/v2/services/audit/pkg/logging" @@ -20,15 +20,10 @@ import ( func Server(cfg *config.Config) *cli.Command { return &cli.Command{ Name: "server", - Usage: fmt.Sprintf("start %s extension without runtime (unsupervised mode)", cfg.Service.Name), + Usage: fmt.Sprintf("start the %s service without runtime (unsupervised mode)", cfg.Service.Name), Category: "server", Before: func(c *cli.Context) error { - err := parser.ParseConfig(cfg) - if err != nil { - fmt.Printf("%v", err) - os.Exit(1) - } - return err + return configlog.ReturnFatal(parser.ParseConfig(cfg)) }, Action: func(c *cli.Context) error { logger := logging.Configure(cfg.Service.Name, cfg.Log) diff --git a/services/audit/pkg/command/version.go b/services/audit/pkg/command/version.go index c3d0eb0b5a8..8b08928c3fe 100644 --- a/services/audit/pkg/command/version.go +++ b/services/audit/pkg/command/version.go @@ -9,7 +9,7 @@ import ( func Version(cfg *config.Config) *cli.Command { return &cli.Command{ Name: "version", - Usage: "print the version of this binary and the running extension instances", + Usage: "print the version of this binary and the running service instances", Category: "info", Action: func(c *cli.Context) error { // not implemented diff --git a/services/auth-basic/pkg/command/health.go b/services/auth-basic/pkg/command/health.go index 48f07427d8c..269847ebb80 100644 --- a/services/auth-basic/pkg/command/health.go +++ b/services/auth-basic/pkg/command/health.go @@ -4,6 +4,7 @@ import ( "fmt" "net/http" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/services/auth-basic/pkg/config" "github.com/owncloud/ocis/v2/services/auth-basic/pkg/config/parser" "github.com/owncloud/ocis/v2/services/auth-basic/pkg/logging" @@ -17,11 +18,7 @@ func Health(cfg *config.Config) *cli.Command { Usage: "check health status", Category: "info", Before: func(c *cli.Context) error { - err := parser.ParseConfig(cfg) - if err != nil { - fmt.Printf("%v", err) - } - return err + return configlog.ReturnError(parser.ParseConfig(cfg)) }, Action: func(c *cli.Context) error { logger := logging.Configure(cfg.Service.Name, cfg.Log) diff --git a/services/auth-basic/pkg/command/server.go b/services/auth-basic/pkg/command/server.go index 4e6a3b57421..4dc4ffba2a0 100644 --- a/services/auth-basic/pkg/command/server.go +++ b/services/auth-basic/pkg/command/server.go @@ -9,6 +9,7 @@ import ( "github.com/cs3org/reva/v2/cmd/revad/runtime" "github.com/gofrs/uuid" "github.com/oklog/run" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/ocis-pkg/ldap" "github.com/owncloud/ocis/v2/ocis-pkg/service/external" "github.com/owncloud/ocis/v2/ocis-pkg/sync" @@ -26,15 +27,10 @@ import ( func Server(cfg *config.Config) *cli.Command { return &cli.Command{ Name: "server", - Usage: fmt.Sprintf("start %s extension without runtime (unsupervised mode)", cfg.Service.Name), + Usage: fmt.Sprintf("start the %s service without runtime (unsupervised mode)", cfg.Service.Name), Category: "server", Before: func(c *cli.Context) error { - err := parser.ParseConfig(cfg) - if err != nil { - fmt.Printf("%v", err) - os.Exit(1) - } - return err + return configlog.ReturnFatal(parser.ParseConfig(cfg)) }, Action: func(c *cli.Context) error { logger := logging.Configure(cfg.Service.Name, cfg.Log) @@ -110,7 +106,7 @@ func Server(cfg *config.Config) *cli.Command { } } -// defineContext sets the context for the extension. If there is a context configured it will create a new child from it, +// defineContext sets the context for the service. If there is a context configured it will create a new child from it, // if not, it will create a root context that can be cancelled. func defineContext(cfg *config.Config) (context.Context, context.CancelFunc) { return func() (context.Context, context.CancelFunc) { diff --git a/services/auth-basic/pkg/command/version.go b/services/auth-basic/pkg/command/version.go index 9e2291bf412..f2bbc5eb3ec 100644 --- a/services/auth-basic/pkg/command/version.go +++ b/services/auth-basic/pkg/command/version.go @@ -16,7 +16,7 @@ import ( func Version(cfg *config.Config) *cli.Command { return &cli.Command{ Name: "version", - Usage: "print the version of this binary and the running extension instances", + Usage: "print the version of this binary and the running service instances", Category: "info", Action: func(c *cli.Context) error { fmt.Println("Version: " + version.GetString()) diff --git a/services/auth-bearer/pkg/command/health.go b/services/auth-bearer/pkg/command/health.go index 040e695b26a..b562eaa4a30 100644 --- a/services/auth-bearer/pkg/command/health.go +++ b/services/auth-bearer/pkg/command/health.go @@ -4,6 +4,7 @@ import ( "fmt" "net/http" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/services/auth-bearer/pkg/config" "github.com/owncloud/ocis/v2/services/auth-bearer/pkg/config/parser" "github.com/owncloud/ocis/v2/services/auth-bearer/pkg/logging" @@ -17,11 +18,7 @@ func Health(cfg *config.Config) *cli.Command { Usage: "check health status", Category: "info", Before: func(c *cli.Context) error { - err := parser.ParseConfig(cfg) - if err != nil { - fmt.Printf("%v", err) - } - return err + return configlog.ReturnError(parser.ParseConfig(cfg)) }, Action: func(c *cli.Context) error { logger := logging.Configure(cfg.Service.Name, cfg.Log) diff --git a/services/auth-bearer/pkg/command/server.go b/services/auth-bearer/pkg/command/server.go index cfa598e5c07..4c181bfab9c 100644 --- a/services/auth-bearer/pkg/command/server.go +++ b/services/auth-bearer/pkg/command/server.go @@ -9,6 +9,7 @@ import ( "github.com/cs3org/reva/v2/cmd/revad/runtime" "github.com/gofrs/uuid" "github.com/oklog/run" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/ocis-pkg/service/external" "github.com/owncloud/ocis/v2/ocis-pkg/sync" "github.com/owncloud/ocis/v2/ocis-pkg/version" @@ -25,15 +26,10 @@ import ( func Server(cfg *config.Config) *cli.Command { return &cli.Command{ Name: "server", - Usage: fmt.Sprintf("start %s extension without runtime (unsupervised mode)", cfg.Service.Name), + Usage: fmt.Sprintf("start the %s service without runtime (unsupervised mode)", cfg.Service.Name), Category: "server", Before: func(c *cli.Context) error { - err := parser.ParseConfig(cfg) - if err != nil { - fmt.Printf("%v", err) - os.Exit(1) - } - return err + return configlog.ReturnFatal(parser.ParseConfig(cfg)) }, Action: func(c *cli.Context) error { logger := logging.Configure(cfg.Service.Name, cfg.Log) @@ -97,7 +93,7 @@ func Server(cfg *config.Config) *cli.Command { } } -// defineContext sets the context for the extension. If there is a context configured it will create a new child from it, +// defineContext sets the context for the service. If there is a context configured it will create a new child from it, // if not, it will create a root context that can be cancelled. func defineContext(cfg *config.Config) (context.Context, context.CancelFunc) { return func() (context.Context, context.CancelFunc) { diff --git a/services/auth-bearer/pkg/command/version.go b/services/auth-bearer/pkg/command/version.go index 030171e1692..1f1af58f687 100644 --- a/services/auth-bearer/pkg/command/version.go +++ b/services/auth-bearer/pkg/command/version.go @@ -16,7 +16,7 @@ import ( func Version(cfg *config.Config) *cli.Command { return &cli.Command{ Name: "version", - Usage: "print the version of this binary and the running extension instances", + Usage: "print the version of this binary and the running services instances", Category: "info", Action: func(c *cli.Context) error { fmt.Println("Version: " + version.GetString()) diff --git a/services/auth-machine/pkg/command/health.go b/services/auth-machine/pkg/command/health.go index cc26ea7f29e..2e04d3a5b5f 100644 --- a/services/auth-machine/pkg/command/health.go +++ b/services/auth-machine/pkg/command/health.go @@ -4,6 +4,7 @@ import ( "fmt" "net/http" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/services/auth-machine/pkg/config" "github.com/owncloud/ocis/v2/services/auth-machine/pkg/config/parser" "github.com/owncloud/ocis/v2/services/auth-machine/pkg/logging" @@ -17,11 +18,7 @@ func Health(cfg *config.Config) *cli.Command { Usage: "check health status", Category: "info", Before: func(c *cli.Context) error { - err := parser.ParseConfig(cfg) - if err != nil { - fmt.Printf("%v", err) - } - return err + return configlog.ReturnError(parser.ParseConfig(cfg)) }, Action: func(c *cli.Context) error { logger := logging.Configure(cfg.Service.Name, cfg.Log) diff --git a/services/auth-machine/pkg/command/server.go b/services/auth-machine/pkg/command/server.go index 7424c30200f..bf2ad19cca0 100644 --- a/services/auth-machine/pkg/command/server.go +++ b/services/auth-machine/pkg/command/server.go @@ -9,6 +9,7 @@ import ( "github.com/cs3org/reva/v2/cmd/revad/runtime" "github.com/gofrs/uuid" "github.com/oklog/run" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/ocis-pkg/service/external" "github.com/owncloud/ocis/v2/ocis-pkg/sync" "github.com/owncloud/ocis/v2/ocis-pkg/version" @@ -25,15 +26,10 @@ import ( func Server(cfg *config.Config) *cli.Command { return &cli.Command{ Name: "server", - Usage: fmt.Sprintf("start %s extension without runtime (unsupervised mode)", cfg.Service.Name), + Usage: fmt.Sprintf("start the %s service without runtime (unsupervised mode)", cfg.Service.Name), Category: "server", Before: func(c *cli.Context) error { - err := parser.ParseConfig(cfg) - if err != nil { - fmt.Printf("%v", err) - os.Exit(1) - } - return err + return configlog.ReturnFatal(parser.ParseConfig(cfg)) }, Action: func(c *cli.Context) error { logger := logging.Configure(cfg.Service.Name, cfg.Log) @@ -97,7 +93,7 @@ func Server(cfg *config.Config) *cli.Command { } } -// defineContext sets the context for the extension. If there is a context configured it will create a new child from it, +// defineContext sets the context for the service. If there is a context configured it will create a new child from it, // if not, it will create a root context that can be cancelled. func defineContext(cfg *config.Config) (context.Context, context.CancelFunc) { return func() (context.Context, context.CancelFunc) { diff --git a/services/auth-machine/pkg/command/version.go b/services/auth-machine/pkg/command/version.go index 1db2354e441..6912c338241 100644 --- a/services/auth-machine/pkg/command/version.go +++ b/services/auth-machine/pkg/command/version.go @@ -16,7 +16,7 @@ import ( func Version(cfg *config.Config) *cli.Command { return &cli.Command{ Name: "version", - Usage: "print the version of this binary and the running extension instances", + Usage: "print the version of this binary and the running service instances", Category: "info", Action: func(c *cli.Context) error { fmt.Println("Version: " + version.GetString()) diff --git a/services/frontend/pkg/command/health.go b/services/frontend/pkg/command/health.go index 15858682615..041dea70a3b 100644 --- a/services/frontend/pkg/command/health.go +++ b/services/frontend/pkg/command/health.go @@ -4,6 +4,7 @@ import ( "fmt" "net/http" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/services/frontend/pkg/config" "github.com/owncloud/ocis/v2/services/frontend/pkg/config/parser" "github.com/owncloud/ocis/v2/services/frontend/pkg/logging" @@ -17,11 +18,7 @@ func Health(cfg *config.Config) *cli.Command { Usage: "check health status", Category: "info", Before: func(c *cli.Context) error { - err := parser.ParseConfig(cfg) - if err != nil { - fmt.Printf("%v", err) - } - return err + return configlog.ReturnError(parser.ParseConfig(cfg)) }, Action: func(c *cli.Context) error { logger := logging.Configure(cfg.Service.Name, cfg.Log) diff --git a/services/frontend/pkg/command/server.go b/services/frontend/pkg/command/server.go index 91fcdf1fc3c..6508799699a 100644 --- a/services/frontend/pkg/command/server.go +++ b/services/frontend/pkg/command/server.go @@ -9,6 +9,7 @@ import ( "github.com/cs3org/reva/v2/cmd/revad/runtime" "github.com/gofrs/uuid" "github.com/oklog/run" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/ocis-pkg/service/external" "github.com/owncloud/ocis/v2/ocis-pkg/sync" "github.com/owncloud/ocis/v2/ocis-pkg/version" @@ -25,15 +26,10 @@ import ( func Server(cfg *config.Config) *cli.Command { return &cli.Command{ Name: "server", - Usage: fmt.Sprintf("start %s extension without runtime (unsupervised mode)", cfg.Service.Name), + Usage: fmt.Sprintf("start the %s service without runtime (unsupervised mode)", cfg.Service.Name), Category: "server", Before: func(c *cli.Context) error { - err := parser.ParseConfig(cfg) - if err != nil { - fmt.Printf("%v", err) - os.Exit(1) - } - return err + return configlog.ReturnFatal(parser.ParseConfig(cfg)) }, Action: func(c *cli.Context) error { logger := logging.Configure(cfg.Service.Name, cfg.Log) @@ -100,7 +96,7 @@ func Server(cfg *config.Config) *cli.Command { } } -// defineContext sets the context for the extension. If there is a context configured it will create a new child from it, +// defineContext sets the context for the service. If there is a context configured it will create a new child from it, // if not, it will create a root context that can be cancelled. func defineContext(cfg *config.Config) (context.Context, context.CancelFunc) { return func() (context.Context, context.CancelFunc) { diff --git a/services/frontend/pkg/command/version.go b/services/frontend/pkg/command/version.go index 77ec32121a8..348b33d6ab9 100644 --- a/services/frontend/pkg/command/version.go +++ b/services/frontend/pkg/command/version.go @@ -16,7 +16,7 @@ import ( func Version(cfg *config.Config) *cli.Command { return &cli.Command{ Name: "version", - Usage: "print the version of this binary and the running extension instances", + Usage: "print the version of this binary and the running service instances", Category: "info", Action: func(c *cli.Context) error { fmt.Println("Version: " + version.GetString()) diff --git a/services/gateway/pkg/command/health.go b/services/gateway/pkg/command/health.go index 1dd8229b695..e2b5231ce9c 100644 --- a/services/gateway/pkg/command/health.go +++ b/services/gateway/pkg/command/health.go @@ -4,6 +4,7 @@ import ( "fmt" "net/http" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/services/gateway/pkg/config" "github.com/owncloud/ocis/v2/services/gateway/pkg/config/parser" "github.com/owncloud/ocis/v2/services/gateway/pkg/logging" @@ -17,11 +18,7 @@ func Health(cfg *config.Config) *cli.Command { Usage: "check health status", Category: "info", Before: func(c *cli.Context) error { - err := parser.ParseConfig(cfg) - if err != nil { - fmt.Printf("%v", err) - } - return err + return configlog.ReturnError(parser.ParseConfig(cfg)) }, Action: func(c *cli.Context) error { logger := logging.Configure(cfg.Service.Name, cfg.Log) diff --git a/services/gateway/pkg/command/server.go b/services/gateway/pkg/command/server.go index adb9d6cf5cc..f2ddf03afab 100644 --- a/services/gateway/pkg/command/server.go +++ b/services/gateway/pkg/command/server.go @@ -9,6 +9,7 @@ import ( "github.com/cs3org/reva/v2/cmd/revad/runtime" "github.com/gofrs/uuid" "github.com/oklog/run" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/ocis-pkg/service/external" "github.com/owncloud/ocis/v2/ocis-pkg/version" "github.com/owncloud/ocis/v2/services/gateway/pkg/config" @@ -24,15 +25,10 @@ import ( func Server(cfg *config.Config) *cli.Command { return &cli.Command{ Name: "server", - Usage: fmt.Sprintf("start %s extension without runtime (unsupervised mode)", cfg.Service.Name), + Usage: fmt.Sprintf("start the %s service without runtime (unsupervised mode)", cfg.Service.Name), Category: "server", Before: func(c *cli.Context) error { - err := parser.ParseConfig(cfg) - if err != nil { - fmt.Printf("%v", err) - os.Exit(1) - } - return err + return configlog.ReturnFatal(parser.ParseConfig(cfg)) }, Action: func(c *cli.Context) error { logger := logging.Configure(cfg.Service.Name, cfg.Log) @@ -92,7 +88,7 @@ func Server(cfg *config.Config) *cli.Command { } } -// defineContext sets the context for the extension. If there is a context configured it will create a new child from it, +// defineContext sets the context for the service. If there is a context configured it will create a new child from it, // if not, it will create a root context that can be cancelled. func defineContext(cfg *config.Config) (context.Context, context.CancelFunc) { return func() (context.Context, context.CancelFunc) { diff --git a/services/gateway/pkg/command/version.go b/services/gateway/pkg/command/version.go index 6e4fcfc0786..52768b243e6 100644 --- a/services/gateway/pkg/command/version.go +++ b/services/gateway/pkg/command/version.go @@ -16,7 +16,7 @@ import ( func Version(cfg *config.Config) *cli.Command { return &cli.Command{ Name: "version", - Usage: "print the version of this binary and the running extension instances", + Usage: "print the version of this binary and the running service instances", Category: "info", Action: func(c *cli.Context) error { fmt.Println("Version: " + version.GetString()) diff --git a/services/graph-explorer/pkg/command/health.go b/services/graph-explorer/pkg/command/health.go index b83a33c820b..96a43029633 100644 --- a/services/graph-explorer/pkg/command/health.go +++ b/services/graph-explorer/pkg/command/health.go @@ -4,6 +4,7 @@ import ( "fmt" "net/http" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/services/graph-explorer/pkg/config" "github.com/owncloud/ocis/v2/services/graph-explorer/pkg/config/parser" "github.com/owncloud/ocis/v2/services/graph-explorer/pkg/logging" @@ -17,11 +18,7 @@ func Health(cfg *config.Config) *cli.Command { Usage: "check health status", Category: "info", Before: func(c *cli.Context) error { - err := parser.ParseConfig(cfg) - if err != nil { - fmt.Printf("%v", err) - } - return err + return configlog.ReturnError(parser.ParseConfig(cfg)) }, Action: func(c *cli.Context) error { logger := logging.Configure(cfg.Service.Name, cfg.Log) diff --git a/services/graph-explorer/pkg/command/server.go b/services/graph-explorer/pkg/command/server.go index 60586a267c2..aa2e5be077a 100644 --- a/services/graph-explorer/pkg/command/server.go +++ b/services/graph-explorer/pkg/command/server.go @@ -3,9 +3,9 @@ package command import ( "context" "fmt" - "os" "github.com/oklog/run" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/ocis-pkg/version" "github.com/owncloud/ocis/v2/services/graph-explorer/pkg/config" "github.com/owncloud/ocis/v2/services/graph-explorer/pkg/config/parser" @@ -21,15 +21,10 @@ import ( func Server(cfg *config.Config) *cli.Command { return &cli.Command{ Name: "server", - Usage: fmt.Sprintf("start %s extension without runtime (unsupervised mode)", cfg.Service.Name), + Usage: fmt.Sprintf("start the %s service without runtime (unsupervised mode)", cfg.Service.Name), Category: "server", Before: func(ctx *cli.Context) error { - err := parser.ParseConfig(cfg) - if err != nil { - fmt.Printf("%v", err) - os.Exit(1) - } - return err + return configlog.ReturnFatal(parser.ParseConfig(cfg)) }, Action: func(c *cli.Context) error { logger := logging.Configure(cfg.Service.Name, cfg.Log) diff --git a/services/graph-explorer/pkg/command/version.go b/services/graph-explorer/pkg/command/version.go index 49b923e9a56..3152b2b4b7f 100644 --- a/services/graph-explorer/pkg/command/version.go +++ b/services/graph-explorer/pkg/command/version.go @@ -16,7 +16,7 @@ import ( func Version(cfg *config.Config) *cli.Command { return &cli.Command{ Name: "version", - Usage: "print the version of this binary and the running extension instances", + Usage: "print the version of this binary and the running service instances", Category: "info", Action: func(c *cli.Context) error { fmt.Println("Version: " + version.GetString()) diff --git a/services/graph-explorer/pkg/service/v0/service.go b/services/graph-explorer/pkg/service/v0/service.go index 055f82388a2..f95b5b806a4 100644 --- a/services/graph-explorer/pkg/service/v0/service.go +++ b/services/graph-explorer/pkg/service/v0/service.go @@ -12,7 +12,7 @@ import ( "github.com/owncloud/ocis/v2/services/graph-explorer/pkg/config" ) -// Service defines the extension handlers. +// Service defines the service handlers. type Service interface { ServeHTTP(http.ResponseWriter, *http.Request) ConfigJs(http.ResponseWriter, *http.Request) diff --git a/services/graph/pkg/command/health.go b/services/graph/pkg/command/health.go index e1cbbbd641c..b3cf03e9be3 100644 --- a/services/graph/pkg/command/health.go +++ b/services/graph/pkg/command/health.go @@ -4,6 +4,7 @@ import ( "fmt" "net/http" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/services/graph/pkg/config" "github.com/owncloud/ocis/v2/services/graph/pkg/config/parser" "github.com/owncloud/ocis/v2/services/graph/pkg/logging" @@ -17,11 +18,7 @@ func Health(cfg *config.Config) *cli.Command { Usage: "check health status", Category: "info", Before: func(c *cli.Context) error { - err := parser.ParseConfig(cfg) - if err != nil { - fmt.Printf("%v", err) - } - return err + return configlog.ReturnError(parser.ParseConfig(cfg)) }, Action: func(c *cli.Context) error { logger := logging.Configure(cfg.Service.Name, cfg.Log) diff --git a/services/graph/pkg/command/server.go b/services/graph/pkg/command/server.go index bdcccc2f385..36a8a5cf946 100644 --- a/services/graph/pkg/command/server.go +++ b/services/graph/pkg/command/server.go @@ -3,9 +3,9 @@ package command import ( "context" "fmt" - "os" "github.com/oklog/run" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/ocis-pkg/version" "github.com/owncloud/ocis/v2/services/graph/pkg/config" "github.com/owncloud/ocis/v2/services/graph/pkg/config/parser" @@ -21,15 +21,10 @@ import ( func Server(cfg *config.Config) *cli.Command { return &cli.Command{ Name: "server", - Usage: fmt.Sprintf("start %s extension without runtime (unsupervised mode)", cfg.Service.Name), + Usage: fmt.Sprintf("start the %s service without runtime (unsupervised mode)", cfg.Service.Name), Category: "server", Before: func(c *cli.Context) error { - err := parser.ParseConfig(cfg) - if err != nil { - fmt.Printf("%v", err) - os.Exit(1) - } - return err + return configlog.ReturnFatal(parser.ParseConfig(cfg)) }, Action: func(c *cli.Context) error { logger := logging.Configure(cfg.Service.Name, cfg.Log) diff --git a/services/graph/pkg/command/version.go b/services/graph/pkg/command/version.go index ebf93b1436e..fd95546f0f8 100644 --- a/services/graph/pkg/command/version.go +++ b/services/graph/pkg/command/version.go @@ -16,7 +16,7 @@ import ( func Version(cfg *config.Config) *cli.Command { return &cli.Command{ Name: "version", - Usage: "print the version of this binary and the running extension instances", + Usage: "print the version of this binary and the running service instances", Category: "info", Action: func(c *cli.Context) error { fmt.Println("Version: " + version.GetString()) diff --git a/services/graph/pkg/service/v0/service.go b/services/graph/pkg/service/v0/service.go index c292b0db70f..ae99880e4c1 100644 --- a/services/graph/pkg/service/v0/service.go +++ b/services/graph/pkg/service/v0/service.go @@ -28,7 +28,7 @@ const ( HeaderPurge = "Purge" ) -// Service defines the extension handlers. +// Service defines the service handlers. type Service interface { ServeHTTP(http.ResponseWriter, *http.Request) GetMe(http.ResponseWriter, *http.Request) diff --git a/services/groups/pkg/command/health.go b/services/groups/pkg/command/health.go index 9925b7ce688..8a48fe36c87 100644 --- a/services/groups/pkg/command/health.go +++ b/services/groups/pkg/command/health.go @@ -4,6 +4,7 @@ import ( "fmt" "net/http" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/services/groups/pkg/config" "github.com/owncloud/ocis/v2/services/groups/pkg/config/parser" "github.com/owncloud/ocis/v2/services/groups/pkg/logging" @@ -17,11 +18,7 @@ func Health(cfg *config.Config) *cli.Command { Usage: "check health status", Category: "info", Before: func(c *cli.Context) error { - err := parser.ParseConfig(cfg) - if err != nil { - fmt.Printf("%v", err) - } - return err + return configlog.ReturnError(parser.ParseConfig(cfg)) }, Action: func(c *cli.Context) error { logger := logging.Configure(cfg.Service.Name, cfg.Log) diff --git a/services/groups/pkg/command/server.go b/services/groups/pkg/command/server.go index d1e872c4221..6605c3dfd3a 100644 --- a/services/groups/pkg/command/server.go +++ b/services/groups/pkg/command/server.go @@ -9,6 +9,7 @@ import ( "github.com/cs3org/reva/v2/cmd/revad/runtime" "github.com/gofrs/uuid" "github.com/oklog/run" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/ocis-pkg/ldap" "github.com/owncloud/ocis/v2/ocis-pkg/service/external" "github.com/owncloud/ocis/v2/ocis-pkg/sync" @@ -26,15 +27,10 @@ import ( func Server(cfg *config.Config) *cli.Command { return &cli.Command{ Name: "server", - Usage: fmt.Sprintf("start %s extension without runtime (unsupervised mode)", cfg.Service.Name), + Usage: fmt.Sprintf("start the %s service without runtime (unsupervised mode)", cfg.Service.Name), Category: "server", Before: func(c *cli.Context) error { - err := parser.ParseConfig(cfg) - if err != nil { - fmt.Printf("%v", err) - os.Exit(1) - } - return err + return configlog.ReturnFatal(parser.ParseConfig(cfg)) }, Action: func(c *cli.Context) error { logger := logging.Configure(cfg.Service.Name, cfg.Log) @@ -110,7 +106,7 @@ func Server(cfg *config.Config) *cli.Command { } } -// defineContext sets the context for the extension. If there is a context configured it will create a new child from it, +// defineContext sets the context for the service. If there is a context configured it will create a new child from it, // if not, it will create a root context that can be cancelled. func defineContext(cfg *config.Config) (context.Context, context.CancelFunc) { return func() (context.Context, context.CancelFunc) { diff --git a/services/groups/pkg/command/version.go b/services/groups/pkg/command/version.go index 1800ebcf272..270cb99c6ed 100644 --- a/services/groups/pkg/command/version.go +++ b/services/groups/pkg/command/version.go @@ -16,7 +16,7 @@ import ( func Version(cfg *config.Config) *cli.Command { return &cli.Command{ Name: "version", - Usage: "print the version of this binary and the running extension instances", + Usage: "print the version of this binary and the running service instances", Category: "info", Action: func(c *cli.Context) error { fmt.Println("Version: " + version.GetString()) diff --git a/services/idm/pkg/command/health.go b/services/idm/pkg/command/health.go index 1b7d5a48410..328ac396901 100644 --- a/services/idm/pkg/command/health.go +++ b/services/idm/pkg/command/health.go @@ -4,6 +4,7 @@ import ( "fmt" "net/http" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/services/idm/pkg/config" "github.com/owncloud/ocis/v2/services/idm/pkg/config/parser" "github.com/owncloud/ocis/v2/services/idm/pkg/logging" @@ -17,11 +18,7 @@ func Health(cfg *config.Config) *cli.Command { Usage: "check health status", Category: "info", Before: func(c *cli.Context) error { - err := parser.ParseConfig(cfg) - if err != nil { - fmt.Printf("%v", err) - } - return err + return configlog.ReturnError(parser.ParseConfig(cfg)) }, Action: func(c *cli.Context) error { logger := logging.Configure(cfg.Service.Name, cfg.Log) diff --git a/services/idm/pkg/command/resetpw.go b/services/idm/pkg/command/resetpw.go index 7fd5c52eba4..415b0479220 100644 --- a/services/idm/pkg/command/resetpw.go +++ b/services/idm/pkg/command/resetpw.go @@ -11,6 +11,7 @@ import ( "github.com/go-ldap/ldap/v3" "github.com/libregraph/idm/pkg/ldbbolt" "github.com/libregraph/idm/server" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/ocis-pkg/log" "github.com/owncloud/ocis/v2/services/idm/pkg/config" "github.com/owncloud/ocis/v2/services/idm/pkg/config/parser" @@ -24,15 +25,10 @@ import ( func ResetPassword(cfg *config.Config) *cli.Command { return &cli.Command{ Name: "resetpassword", - Usage: fmt.Sprintf("Reset admin password"), + Usage: "Reset admin password", Category: "password reset", Before: func(c *cli.Context) error { - err := parser.ParseConfig(cfg) - if err != nil { - fmt.Printf("%v", err) - os.Exit(1) - } - return err + return configlog.ReturnFatal(parser.ParseConfig(cfg)) }, Action: func(c *cli.Context) error { logger := logging.Configure(cfg.Service.Name, cfg.Log) diff --git a/services/idm/pkg/command/server.go b/services/idm/pkg/command/server.go index bd1cca2b10f..f8e8561dc1d 100644 --- a/services/idm/pkg/command/server.go +++ b/services/idm/pkg/command/server.go @@ -13,6 +13,7 @@ import ( "github.com/libregraph/idm/pkg/ldappassword" "github.com/libregraph/idm/pkg/ldbbolt" "github.com/libregraph/idm/server" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" pkgcrypto "github.com/owncloud/ocis/v2/ocis-pkg/crypto" "github.com/owncloud/ocis/v2/ocis-pkg/log" "github.com/owncloud/ocis/v2/services/idm" @@ -26,15 +27,10 @@ import ( func Server(cfg *config.Config) *cli.Command { return &cli.Command{ Name: "server", - Usage: fmt.Sprintf("start %s extension without runtime (unsupervised mode)", cfg.Service.Name), + Usage: fmt.Sprintf("start the %s service without runtime (unsupervised mode)", cfg.Service.Name), Category: "server", Before: func(c *cli.Context) error { - err := parser.ParseConfig(cfg) - if err != nil { - fmt.Printf("%v", err) - os.Exit(1) - } - return err + return configlog.ReturnFatal(parser.ParseConfig(cfg)) }, Action: func(c *cli.Context) error { logger := logging.Configure(cfg.Service.Name, cfg.Log) diff --git a/services/idm/pkg/command/version.go b/services/idm/pkg/command/version.go index f18727e12fb..b9834afe39f 100644 --- a/services/idm/pkg/command/version.go +++ b/services/idm/pkg/command/version.go @@ -9,7 +9,7 @@ import ( func Version(cfg *config.Config) *cli.Command { return &cli.Command{ Name: "version", - Usage: "print the version of this binary and the running extension instances", + Usage: "print the version of this binary and the running service instances", Category: "info", Action: func(c *cli.Context) error { // not implemented diff --git a/services/idp/pkg/command/health.go b/services/idp/pkg/command/health.go index 687d806fe5f..461bd5cbef6 100644 --- a/services/idp/pkg/command/health.go +++ b/services/idp/pkg/command/health.go @@ -4,6 +4,7 @@ import ( "fmt" "net/http" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/services/idp/pkg/config" "github.com/owncloud/ocis/v2/services/idp/pkg/config/parser" "github.com/owncloud/ocis/v2/services/idp/pkg/logging" @@ -17,11 +18,7 @@ func Health(cfg *config.Config) *cli.Command { Usage: "check health status", Category: "info", Before: func(c *cli.Context) error { - err := parser.ParseConfig(cfg) - if err != nil { - fmt.Printf("%v", err) - } - return err + return configlog.ReturnError(parser.ParseConfig(cfg)) }, Action: func(c *cli.Context) error { logger := logging.Configure(cfg.Service.Name, cfg.Log) diff --git a/services/idp/pkg/command/server.go b/services/idp/pkg/command/server.go index 4991a385e33..a17d0c42d43 100644 --- a/services/idp/pkg/command/server.go +++ b/services/idp/pkg/command/server.go @@ -15,6 +15,7 @@ import ( "path/filepath" "github.com/oklog/run" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/ocis-pkg/version" "github.com/owncloud/ocis/v2/services/idp/pkg/config" "github.com/owncloud/ocis/v2/services/idp/pkg/config/parser" @@ -32,14 +33,10 @@ const _rsaKeySize = 4096 func Server(cfg *config.Config) *cli.Command { return &cli.Command{ Name: "server", - Usage: fmt.Sprintf("start %s extension without runtime (unsupervised mode)", cfg.Service.Name), + Usage: fmt.Sprintf("start the %s service without runtime (unsupervised mode)", cfg.Service.Name), Category: "server", Before: func(c *cli.Context) error { - err := parser.ParseConfig(cfg) - if err != nil { - fmt.Printf("%v", err) - os.Exit(1) - } + configlog.ReturnFatal(parser.ParseConfig(cfg)) if cfg.IDP.EncryptionSecretFile != "" { if err := ensureEncryptionSecretExists(cfg.IDP.EncryptionSecretFile); err != nil { @@ -49,7 +46,7 @@ func Server(cfg *config.Config) *cli.Command { return err } } - return err + return nil }, Action: func(c *cli.Context) error { logger := logging.Configure(cfg.Service.Name, cfg.Log) diff --git a/services/idp/pkg/command/version.go b/services/idp/pkg/command/version.go index 59652acf502..392d9178f69 100644 --- a/services/idp/pkg/command/version.go +++ b/services/idp/pkg/command/version.go @@ -16,7 +16,7 @@ import ( func Version(cfg *config.Config) *cli.Command { return &cli.Command{ Name: "version", - Usage: "print the version of this binary and the running extension instances", + Usage: "print the version of this binary and the running service instances", Category: "info", Action: func(c *cli.Context) error { fmt.Println("Version: " + version.GetString()) diff --git a/services/idp/pkg/service/v0/service.go b/services/idp/pkg/service/v0/service.go index a32a0ecb298..ce47018cca9 100644 --- a/services/idp/pkg/service/v0/service.go +++ b/services/idp/pkg/service/v0/service.go @@ -29,7 +29,7 @@ import ( "stash.kopano.io/kgol/rndm" ) -// Service defines the extension handlers. +// Service defines the service handlers. type Service interface { ServeHTTP(http.ResponseWriter, *http.Request) } diff --git a/services/nats/pkg/command/server.go b/services/nats/pkg/command/server.go index 08ef0b44265..d2817590790 100644 --- a/services/nats/pkg/command/server.go +++ b/services/nats/pkg/command/server.go @@ -3,10 +3,10 @@ package command import ( "context" "fmt" - "os" "github.com/oklog/run" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/services/nats/pkg/config" "github.com/owncloud/ocis/v2/services/nats/pkg/config/parser" "github.com/owncloud/ocis/v2/services/nats/pkg/logging" @@ -18,15 +18,10 @@ import ( func Server(cfg *config.Config) *cli.Command { return &cli.Command{ Name: "server", - Usage: fmt.Sprintf("start %s extension without runtime (unsupervised mode)", cfg.Service.Name), + Usage: fmt.Sprintf("start the %s service without runtime (unsupervised mode)", cfg.Service.Name), Category: "server", Before: func(c *cli.Context) error { - err := parser.ParseConfig(cfg) - if err != nil { - fmt.Printf("%v", err) - os.Exit(1) - } - return err + return configlog.ReturnFatal(parser.ParseConfig(cfg)) }, Action: func(c *cli.Context) error { logger := logging.Configure(cfg.Service.Name, cfg.Log) diff --git a/services/nats/pkg/command/version.go b/services/nats/pkg/command/version.go index cedb412b1e8..7e82763e156 100644 --- a/services/nats/pkg/command/version.go +++ b/services/nats/pkg/command/version.go @@ -9,7 +9,7 @@ import ( func Version(cfg *config.Config) *cli.Command { return &cli.Command{ Name: "version", - Usage: "print the version of this binary and the running extension instances", + Usage: "print the version of this binary and the running service instances", Category: "info", Action: func(c *cli.Context) error { // not implemented diff --git a/services/notifications/pkg/channels/channels.go b/services/notifications/pkg/channels/channels.go index 896dc8afcff..06129399800 100644 --- a/services/notifications/pkg/channels/channels.go +++ b/services/notifications/pkg/channels/channels.go @@ -4,6 +4,7 @@ package channels import ( "context" "crypto/tls" + "strings" gateway "github.com/cs3org/go-cs3apis/cs3/gateway/v1beta1" groups "github.com/cs3org/go-cs3apis/cs3/identity/group/v1beta1" @@ -45,6 +46,59 @@ type Mail struct { logger log.Logger } +func (m Mail) getMailClient() (*mail.SMTPClient, error) { + server := mail.NewSMTPClient() + server.Host = m.conf.Notifications.SMTP.Host + server.Port = m.conf.Notifications.SMTP.Port + server.Username = m.conf.Notifications.SMTP.Username + if server.Username == "" { + // compatibility fallback + server.Username = m.conf.Notifications.SMTP.Sender + } + server.Password = m.conf.Notifications.SMTP.Password + if server.TLSConfig == nil { + server.TLSConfig = &tls.Config{} + } + server.TLSConfig.InsecureSkipVerify = m.conf.Notifications.SMTP.Insecure + + switch strings.ToLower(m.conf.Notifications.SMTP.Authentication) { + case "login": + server.Authentication = mail.AuthLogin + case "plain": + server.Authentication = mail.AuthPlain + case "crammd5": + server.Authentication = mail.AuthCRAMMD5 + case "none": + server.Authentication = mail.AuthNone + default: + return nil, errors.New("unknown mail authentication method") + } + + switch strings.ToLower(m.conf.Notifications.SMTP.Encryption) { + case "tls": + server.Encryption = mail.EncryptionTLS + server.TLSConfig.ServerName = m.conf.Notifications.SMTP.Host + case "starttls": + server.Encryption = mail.EncryptionSTARTTLS + server.TLSConfig.ServerName = m.conf.Notifications.SMTP.Host + case "ssl": + server.Encryption = mail.EncryptionSSL + case "ssltls": + server.Encryption = mail.EncryptionSSLTLS + case "none": + server.Encryption = mail.EncryptionNone + default: + return nil, errors.New("unknown mail encryption method") + } + + smtpClient, err := server.Connect() + if err != nil { + return nil, err + } + + return smtpClient, nil +} + // SendMessage sends a message to all given users. func (m Mail) SendMessage(userIDs []string, msg string) error { if m.conf.Notifications.SMTP.Host == "" { @@ -56,22 +110,13 @@ func (m Mail) SendMessage(userIDs []string, msg string) error { return err } - server := mail.NewSMTPClient() - server.Host = m.conf.Notifications.SMTP.Host - server.Port = m.conf.Notifications.SMTP.Port - server.Username = m.conf.Notifications.SMTP.Sender - server.Password = m.conf.Notifications.SMTP.Password - server.TLSConfig = &tls.Config{InsecureSkipVerify: m.conf.Notifications.SMTP.Insecure} - - smtpClient, err := server.Connect() + smtpClient, err := m.getMailClient() if err != nil { return err } email := mail.NewMSG() - email.SetFrom(m.conf.Notifications.SMTP.Sender).AddTo(to...) - email.SetBody(mail.TextPlain, msg) return email.Send(smtpClient) diff --git a/services/notifications/pkg/command/server.go b/services/notifications/pkg/command/server.go index 35afd764663..996cd6fceed 100644 --- a/services/notifications/pkg/command/server.go +++ b/services/notifications/pkg/command/server.go @@ -2,11 +2,11 @@ package command import ( "fmt" - "os" "github.com/cs3org/reva/v2/pkg/events" "github.com/cs3org/reva/v2/pkg/events/server" "github.com/go-micro/plugins/v4/events/natsjs" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/services/notifications/pkg/channels" "github.com/owncloud/ocis/v2/services/notifications/pkg/config" "github.com/owncloud/ocis/v2/services/notifications/pkg/config/parser" @@ -19,15 +19,10 @@ import ( func Server(cfg *config.Config) *cli.Command { return &cli.Command{ Name: "server", - Usage: fmt.Sprintf("start %s extension without runtime (unsupervised mode)", cfg.Service.Name), + Usage: fmt.Sprintf("start the %s service without runtime (unsupervised mode)", cfg.Service.Name), Category: "server", Before: func(c *cli.Context) error { - err := parser.ParseConfig(cfg) - if err != nil { - fmt.Printf("%v", err) - os.Exit(1) - } - return err + return configlog.ReturnFatal(parser.ParseConfig(cfg)) }, Action: func(c *cli.Context) error { logger := logging.Configure(cfg.Service.Name, cfg.Log) diff --git a/services/notifications/pkg/command/version.go b/services/notifications/pkg/command/version.go index 153f65af383..3d288bb7766 100644 --- a/services/notifications/pkg/command/version.go +++ b/services/notifications/pkg/command/version.go @@ -9,7 +9,7 @@ import ( func Version(cfg *config.Config) *cli.Command { return &cli.Command{ Name: "version", - Usage: "print the version of this binary and the running extension instances", + Usage: "print the version of this binary and the running service instances", Category: "info", Action: func(c *cli.Context) error { // not implemented diff --git a/services/notifications/pkg/config/config.go b/services/notifications/pkg/config/config.go index ba23d12c616..849f1ac1ff6 100644 --- a/services/notifications/pkg/config/config.go +++ b/services/notifications/pkg/config/config.go @@ -30,11 +30,14 @@ type Notifications struct { // SMTP combines the smtp configuration options. type SMTP struct { - Host string `yaml:"smtp_host" env:"NOTIFICATIONS_SMTP_HOST" desc:"SMTP host to connect to."` - Port int `yaml:"smtp_port" env:"NOTIFICATIONS_SMTP_PORT" desc:"Port of the SMTP host to connect to."` - Sender string `yaml:"smtp_sender" env:"NOTIFICATIONS_SMTP_SENDER" desc:"Sender of emails that will be sent."` - Password string `yaml:"smtp_password" env:"NOTIFICATIONS_SMTP_PASSWORD" desc:"Password of the SMTP host to connect to."` - Insecure bool `yaml:"insecure" env:"NOTIFICATIONS_SMTP_INSECURE" desc:"Allow insecure connections to the SMTP server."` + Host string `yaml:"smtp_host" env:"NOTIFICATIONS_SMTP_HOST" desc:"SMTP host to connect to."` + Port int `yaml:"smtp_port" env:"NOTIFICATIONS_SMTP_PORT" desc:"Port of the SMTP host to connect to."` + Sender string `yaml:"smtp_sender" env:"NOTIFICATIONS_SMTP_SENDER" desc:"Sender address of emails that will be sent."` + Username string `yaml:"smtp_username" env:"NOTIFICATIONS_SMTP_USERNAME" desc:"Username for the SMTP host to connect to."` + Password string `yaml:"smtp_password" env:"NOTIFICATIONS_SMTP_PASSWORD" desc:"Password for the SMTP host to connect to."` + Insecure bool `yaml:"insecure" env:"NOTIFICATIONS_SMTP_INSECURE" desc:"Allow insecure connections to the SMTP server."` + Authentication string `yaml:"smtp_authentication" env:"NOTIFICATIONS_SMTP_AUTHENTICATION" desc:"Authentication method for the SMTP communication. Possible values are 'login', 'plain', 'crammd5', 'none'"` + Encryption string `yaml:"smtp_encryption" env:"NOTIFICATIONS_SMTP_ENCRYPTION" desc:"Encryption method for the SMTP communication. Possible values are 'starttls', 'ssl', 'ssltls', 'tls' and 'none'."` } // Events combines the configuration options for the event bus. diff --git a/services/notifications/pkg/config/defaults/defaultconfig.go b/services/notifications/pkg/config/defaults/defaultconfig.go index acd443345b2..849592926c1 100644 --- a/services/notifications/pkg/config/defaults/defaultconfig.go +++ b/services/notifications/pkg/config/defaults/defaultconfig.go @@ -24,9 +24,11 @@ func DefaultConfig() *config.Config { }, Notifications: config.Notifications{ SMTP: config.SMTP{ - Host: "", - Port: 1025, - Sender: "noreply@example.com", + Host: "", + Port: 1025, + Sender: "ownCloud ", + Authentication: "none", + Encryption: "none", }, Events: config.Events{ Endpoint: "127.0.0.1:9233", diff --git a/services/ocdav/pkg/command/health.go b/services/ocdav/pkg/command/health.go index 8724a43adbe..c207e17f2d0 100644 --- a/services/ocdav/pkg/command/health.go +++ b/services/ocdav/pkg/command/health.go @@ -4,6 +4,7 @@ import ( "fmt" "net/http" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/services/ocdav/pkg/config" "github.com/owncloud/ocis/v2/services/ocdav/pkg/config/parser" "github.com/owncloud/ocis/v2/services/ocdav/pkg/logging" @@ -17,11 +18,7 @@ func Health(cfg *config.Config) *cli.Command { Usage: "check health status", Category: "info", Before: func(c *cli.Context) error { - err := parser.ParseConfig(cfg) - if err != nil { - fmt.Printf("%v", err) - } - return err + return configlog.ReturnError(parser.ParseConfig(cfg)) }, Action: func(c *cli.Context) error { logger := logging.Configure(cfg.Service.Name, cfg.Log) diff --git a/services/ocdav/pkg/command/server.go b/services/ocdav/pkg/command/server.go index d8faf9b72b4..017931596b8 100644 --- a/services/ocdav/pkg/command/server.go +++ b/services/ocdav/pkg/command/server.go @@ -3,10 +3,10 @@ package command import ( "context" "fmt" - "os" "github.com/cs3org/reva/v2/pkg/micro/ocdav" "github.com/oklog/run" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/ocis-pkg/version" "github.com/owncloud/ocis/v2/services/ocdav/pkg/config" "github.com/owncloud/ocis/v2/services/ocdav/pkg/config/parser" @@ -20,15 +20,10 @@ import ( func Server(cfg *config.Config) *cli.Command { return &cli.Command{ Name: "server", - Usage: fmt.Sprintf("start %s extension without runtime (unsupervised mode)", cfg.Service.Name), + Usage: fmt.Sprintf("start the %s service without runtime (unsupervised mode)", cfg.Service.Name), Category: "server", Before: func(c *cli.Context) error { - err := parser.ParseConfig(cfg) - if err != nil { - fmt.Printf("%v", err) - os.Exit(1) - } - return err + return configlog.ReturnFatal(parser.ParseConfig(cfg)) }, Action: func(c *cli.Context) error { logger := logging.Configure(cfg.Service.Name, cfg.Log) @@ -110,7 +105,7 @@ func Server(cfg *config.Config) *cli.Command { } } -// defineContext sets the context for the extension. If there is a context configured it will create a new child from it, +// defineContext sets the context for the service. If there is a context configured it will create a new child from it, // if not, it will create a root context that can be cancelled. func defineContext(cfg *config.Config) (context.Context, context.CancelFunc) { return func() (context.Context, context.CancelFunc) { diff --git a/services/ocdav/pkg/command/version.go b/services/ocdav/pkg/command/version.go index 71ab3f90192..6025ef48245 100644 --- a/services/ocdav/pkg/command/version.go +++ b/services/ocdav/pkg/command/version.go @@ -16,7 +16,7 @@ import ( func Version(cfg *config.Config) *cli.Command { return &cli.Command{ Name: "version", - Usage: "print the version of this binary and the running extension instances", + Usage: "print the version of this binary and the running service instances", Category: "info", Action: func(c *cli.Context) error { fmt.Println("Version: " + version.GetString()) diff --git a/services/ocs/pkg/command/health.go b/services/ocs/pkg/command/health.go index 197c2e1ca82..e4939db9e1f 100644 --- a/services/ocs/pkg/command/health.go +++ b/services/ocs/pkg/command/health.go @@ -4,6 +4,7 @@ import ( "fmt" "net/http" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/services/ocs/pkg/config" "github.com/owncloud/ocis/v2/services/ocs/pkg/config/parser" "github.com/owncloud/ocis/v2/services/ocs/pkg/logging" @@ -17,11 +18,7 @@ func Health(cfg *config.Config) *cli.Command { Usage: "check health status", Category: "info", Before: func(c *cli.Context) error { - err := parser.ParseConfig(cfg) - if err != nil { - fmt.Printf("%v", err) - } - return err + return configlog.ReturnError(parser.ParseConfig(cfg)) }, Action: func(c *cli.Context) error { logger := logging.Configure(cfg.Service.Name, cfg.Log) diff --git a/services/ocs/pkg/command/server.go b/services/ocs/pkg/command/server.go index 669fea4f6eb..7c3b6c989b4 100644 --- a/services/ocs/pkg/command/server.go +++ b/services/ocs/pkg/command/server.go @@ -3,8 +3,8 @@ package command import ( "context" "fmt" - "os" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/ocis-pkg/version" "github.com/owncloud/ocis/v2/services/ocs/pkg/config/parser" "github.com/owncloud/ocis/v2/services/ocs/pkg/logging" @@ -22,15 +22,10 @@ import ( func Server(cfg *config.Config) *cli.Command { return &cli.Command{ Name: "server", - Usage: fmt.Sprintf("start %s extension without runtime (unsupervised mode)", cfg.Service.Name), + Usage: fmt.Sprintf("start the %s service without runtime (unsupervised mode)", cfg.Service.Name), Category: "server", Before: func(c *cli.Context) error { - err := parser.ParseConfig(cfg) - if err != nil { - fmt.Printf("%v", err) - os.Exit(1) - } - return err + return configlog.ReturnFatal(parser.ParseConfig(cfg)) }, Action: func(c *cli.Context) error { logger := logging.Configure(cfg.Service.Name, cfg.Log) diff --git a/services/ocs/pkg/command/version.go b/services/ocs/pkg/command/version.go index 4d3bf8bba22..06e48e76efa 100644 --- a/services/ocs/pkg/command/version.go +++ b/services/ocs/pkg/command/version.go @@ -16,7 +16,7 @@ import ( func Version(cfg *config.Config) *cli.Command { return &cli.Command{ Name: "version", - Usage: "print the version of this binary and the running extension instances", + Usage: "print the version of this binary and the running service instances", Category: "info", Action: func(c *cli.Context) error { fmt.Println("Version: " + version.GetString()) diff --git a/services/ocs/pkg/service/v0/service.go b/services/ocs/pkg/service/v0/service.go index 372d0c9c955..6a568ee35f8 100644 --- a/services/ocs/pkg/service/v0/service.go +++ b/services/ocs/pkg/service/v0/service.go @@ -23,7 +23,7 @@ import ( "github.com/owncloud/ocis/v2/services/proxy/pkg/user/backend" ) -// Service defines the extension handlers. +// Service defines the service handlers. type Service interface { ServeHTTP(http.ResponseWriter, *http.Request) GetConfig(http.ResponseWriter, *http.Request) diff --git a/services/proxy/pkg/command/health.go b/services/proxy/pkg/command/health.go index cb9ee814bf4..824d626e51d 100644 --- a/services/proxy/pkg/command/health.go +++ b/services/proxy/pkg/command/health.go @@ -4,6 +4,7 @@ import ( "fmt" "net/http" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/services/proxy/pkg/config" "github.com/owncloud/ocis/v2/services/proxy/pkg/config/parser" "github.com/owncloud/ocis/v2/services/proxy/pkg/logging" @@ -17,11 +18,7 @@ func Health(cfg *config.Config) *cli.Command { Usage: "check health status", Category: "info", Before: func(c *cli.Context) error { - err := parser.ParseConfig(cfg) - if err != nil { - fmt.Printf("%v", err) - } - return err + return configlog.ReturnError(parser.ParseConfig(cfg)) }, Action: func(c *cli.Context) error { logger := logging.Configure(cfg.Service.Name, cfg.Log) diff --git a/services/proxy/pkg/command/server.go b/services/proxy/pkg/command/server.go index 79c742d8060..00eb77f0527 100644 --- a/services/proxy/pkg/command/server.go +++ b/services/proxy/pkg/command/server.go @@ -5,7 +5,6 @@ import ( "crypto/tls" "fmt" "net/http" - "os" "time" "github.com/coreos/go-oidc/v3/oidc" @@ -13,6 +12,7 @@ import ( chimiddleware "github.com/go-chi/chi/v5/middleware" "github.com/justinas/alice" "github.com/oklog/run" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/ocis-pkg/log" pkgmiddleware "github.com/owncloud/ocis/v2/ocis-pkg/middleware" "github.com/owncloud/ocis/v2/ocis-pkg/service/grpc" @@ -38,15 +38,10 @@ import ( func Server(cfg *config.Config) *cli.Command { return &cli.Command{ Name: "server", - Usage: fmt.Sprintf("start %s extension without runtime (unsupervised mode)", cfg.Service.Name), + Usage: fmt.Sprintf("start the %s service without runtime (unsupervised mode)", cfg.Service.Name), Category: "server", Before: func(c *cli.Context) error { - err := parser.ParseConfig(cfg) - if err != nil { - fmt.Printf("%v", err) - os.Exit(1) - } - return err + return configlog.ReturnFatal(parser.ParseConfig(cfg)) }, Action: func(c *cli.Context) error { logger := logging.Configure(cfg.Service.Name, cfg.Log) @@ -166,6 +161,43 @@ func loadMiddlewares(ctx context.Context, logger log.Logger, cfg *config.Config) Timeout: time.Second * 10, } + var authenticators []middleware.Authenticator + if cfg.EnableBasicAuth { + logger.Warn().Msg("basic auth enabled, use only for testing or development") + authenticators = append(authenticators, middleware.BasicAuthenticator{ + Logger: logger, + UserProvider: userProvider, + }) + } + authenticators = append(authenticators, middleware.NewOIDCAuthenticator( + logger, + cfg.OIDC.UserinfoCache.TTL, + oidcHTTPClient, + cfg.OIDC.Issuer, + func() (middleware.OIDCProvider, error) { + // Initialize a provider by specifying the issuer URL. + // it will fetch the keys from the issuer using the .well-known + // endpoint + return oidc.NewProvider( + context.WithValue(ctx, oauth2.HTTPClient, oidcHTTPClient), + cfg.OIDC.Issuer, + ) + }, + cfg.OIDC.JWKS, + cfg.OIDC.AccessTokenVerifyMethod, + )) + authenticators = append(authenticators, middleware.PublicShareAuthenticator{ + Logger: logger, + RevaGatewayClient: revaClient, + }) + + authenticators = append(authenticators, middleware.SignedURLAuthenticator{ + Logger: logger, + PreSignedURLConfig: cfg.PreSignedURL, + UserProvider: userProvider, + Store: storeClient, + }) + return alice.New( // first make sure we log all requests and redirect to https if necessary pkgmiddleware.TraceContext, @@ -179,38 +211,12 @@ func loadMiddlewares(ctx context.Context, logger log.Logger, cfg *config.Config) oidcHTTPClient, ), - // now that we established the basics, on with authentication middleware middleware.Authentication( - // OIDC Options - middleware.OIDCProviderFunc(func() (middleware.OIDCProvider, error) { - // Initialize a provider by specifying the issuer URL. - // it will fetch the keys from the issuer using the .well-known - // endpoint - return oidc.NewProvider( - context.WithValue(ctx, oauth2.HTTPClient, oidcHTTPClient), - cfg.OIDC.Issuer, - ) - }), - middleware.HTTPClient(oidcHTTPClient), - middleware.TokenCacheSize(cfg.OIDC.UserinfoCache.Size), - middleware.TokenCacheTTL(time.Second*time.Duration(cfg.OIDC.UserinfoCache.TTL)), - middleware.AccessTokenVerifyMethod(cfg.OIDC.AccessTokenVerifyMethod), - middleware.JWKSOptions(cfg.OIDC.JWKS), - - // basic Options - middleware.Logger(logger), - middleware.EnableBasicAuth(cfg.EnableBasicAuth), - middleware.UserProvider(userProvider), - middleware.OIDCIss(cfg.OIDC.Issuer), - middleware.UserOIDCClaim(cfg.UserOIDCClaim), - middleware.UserCS3Claim(cfg.UserCS3Claim), + authenticators, middleware.CredentialsByUserAgent(cfg.AuthMiddleware.CredentialsByUserAgent), - ), - middleware.SignedURLAuth( middleware.Logger(logger), - middleware.PreSignedURLConfig(cfg.PreSignedURL), - middleware.UserProvider(userProvider), - middleware.Store(storeClient), + middleware.OIDCIss(cfg.OIDC.Issuer), + middleware.EnableBasicAuth(cfg.EnableBasicAuth), ), middleware.AccountResolver( middleware.Logger(logger), @@ -234,9 +240,5 @@ func loadMiddlewares(ctx context.Context, logger log.Logger, cfg *config.Config) middleware.RevaGatewayClient(revaClient), middleware.DefaultSpaceQuota(cfg.DefaultSpaceQuota), ), - middleware.PublicShareAuth( - middleware.Logger(logger), - middleware.RevaGatewayClient(revaClient), - ), ) } diff --git a/services/proxy/pkg/command/version.go b/services/proxy/pkg/command/version.go index b24caa11bac..0cf3e85b1d0 100644 --- a/services/proxy/pkg/command/version.go +++ b/services/proxy/pkg/command/version.go @@ -16,7 +16,7 @@ import ( func Version(cfg *config.Config) *cli.Command { return &cli.Command{ Name: "version", - Usage: "Print the version of this binary and the running extension instances", + Usage: "Print the version of this binary and the running service instances", Category: "Version", Action: func(c *cli.Context) error { fmt.Println("Version: " + version.GetString()) diff --git a/services/proxy/pkg/middleware/authentication.go b/services/proxy/pkg/middleware/authentication.go index 15fa4ec4299..99dced8d681 100644 --- a/services/proxy/pkg/middleware/authentication.go +++ b/services/proxy/pkg/middleware/authentication.go @@ -5,6 +5,10 @@ import ( "net/http" "regexp" "strings" + + "github.com/owncloud/ocis/v2/services/proxy/pkg/webdav" + "golang.org/x/text/cases" + "golang.org/x/text/language" ) var ( @@ -12,48 +16,158 @@ var ( SupportedAuthStrategies []string // ProxyWwwAuthenticate is a list of endpoints that do not rely on reva underlying authentication, such as ocs. - // services that fallback to reva authentication are declared in the "frontend" command on oCIS. It is a list of strings - // to be regexp compiled. - ProxyWwwAuthenticate = []string{"/ocs/v[12].php/cloud/"} + // services that fallback to reva authentication are declared in the "frontend" command on oCIS. It is a list of + // regexp.Regexp which are safe to use concurrently. + ProxyWwwAuthenticate = []regexp.Regexp{*regexp.MustCompile("/ocs/v[12].php/cloud/")} - // WWWAuthenticate captures the Www-Authenticate header string. - WWWAuthenticate = "Www-Authenticate" + _publicPaths = [...]string{ + "/dav/public-files/", + "/remote.php/dav/public-files/", + "/remote.php/ocs/apps/files_sharing/api/v1/tokeninfo/unprotected", + "/ocs/v1.php/cloud/capabilities", + } + // _unprotectedPaths contains paths which don't need to be authenticated. + _unprotectedPaths = map[string]struct{}{ + "/": {}, + "/login": {}, + "/settings": {}, + "/app/list": {}, + "/config.json": {}, + "/manifest.json": {}, + "/oidc-callback.html": {}, + "/oidc-callback": {}, + "/settings.js": {}, + "/data": {}, + "/konnect/v1/userinfo": {}, + "/status.php": {}, + "/favicon.ico": {}, + "/ocs/v1.php/config": {}, + "/ocs/v2.php/config": {}, + } + // _unprotectedPathPrefixes contains paths which don't need to be authenticated. + _unprotectedPathPrefixes = [...]string{ + "/files/", + "/data/", + "/account/", + "/s/", + "/external/spaces", + "/apps/openidconnect/redirect", + "/settings/", + "/user-management/", + "/.well-known/", + "/js/", + "/css/", + "/fonts/", + "/icons/", + "/themes/", + "/signin/", + "/konnect/", + } ) -// userAgentLocker aids in dependency injection for helper methods. The set of fields is arbitrary and the only relation -// they share is to fulfill their duty and lock a User-Agent to its correct challenge if configured. -type userAgentLocker struct { - w http.ResponseWriter - r *http.Request - locks map[string]string // locks represents a reva user-agent:challenge mapping. - fallback string +const ( + // WwwAuthenticate captures the Www-Authenticate header string. + WwwAuthenticate = "Www-Authenticate" +) + +// Authenticator is the common interface implemented by all request authenticators. +type Authenticator interface { + // Authenticate is used to authenticate incoming HTTP requests. + // The Authenticator may augment the request with user info or anything related to the + // authentication and return the augmented request. + Authenticate(*http.Request) (*http.Request, bool) } // Authentication is a higher order authentication middleware. -func Authentication(opts ...Option) func(next http.Handler) http.Handler { +func Authentication(auths []Authenticator, opts ...Option) func(next http.Handler) http.Handler { options := newOptions(opts...) - configureSupportedChallenges(options) - oidc := newOIDCAuth(options) - basic := newBasicAuth(options) return func(next http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - if options.OIDCIss != "" && options.EnableBasicAuth { - oidc(basic(next)).ServeHTTP(w, r) + if isOIDCTokenAuth(r) || isUnprotectedPath(r) { + // The authentication for this request is handled by the IdP. + next.ServeHTTP(w, r) + return } - if options.OIDCIss != "" && !options.EnableBasicAuth { - oidc(next).ServeHTTP(w, r) + for _, a := range auths { + if req, ok := a.Authenticate(r); ok { + next.ServeHTTP(w, req) + return + } + } + if !isPublicPath(r.URL.Path) { + // Failed basic authentication attempts receive the Www-Authenticate header in the response + var touch bool + caser := cases.Title(language.Und) + for k, v := range options.CredentialsByUserAgent { + if strings.Contains(k, r.UserAgent()) { + removeSuperfluousAuthenticate(w) + w.Header().Add("Www-Authenticate", fmt.Sprintf("%v realm=\"%s\", charset=\"UTF-8\"", caser.String(v), r.Host)) + touch = true + break + } + } + + // if the request is not bound to any user agent, write all available challenges + if !touch && + // This is a temporary hack... Before the authentication middleware rewrite all + // unauthenticated requests were still handled. The reva http services then did add + // the supported authentication headers to the response. Since we are not allowing the + // requests to continue so far we have to do it here. But we shouldn't do it for the graph service. + // That's the reason for this hard check here. + !strings.HasPrefix(r.URL.Path, "/graph") { + writeSupportedAuthenticateHeader(w, r) + } } - if options.OIDCIss == "" && options.EnableBasicAuth { - basic(next).ServeHTTP(w, r) + for _, s := range SupportedAuthStrategies { + userAgentAuthenticateLockIn(w, r, options.CredentialsByUserAgent, s) + } + w.WriteHeader(http.StatusUnauthorized) + // if the request is a PROPFIND return a WebDAV error code. + // TODO: The proxy has to be smart enough to detect when a request is directed towards a webdav server + // and react accordingly. + if webdav.IsWebdavRequest(r) { + b, err := webdav.Marshal(webdav.Exception{ + Code: webdav.SabredavPermissionDenied, + Message: "Authentication error", + }) + + webdav.HandleWebdavError(w, b, err) } }) } } +// The token auth endpoint uses basic auth for clients, see https://openid.net/specs/openid-connect-basic-1_0.html#TokenRequest +// > The Client MUST authenticate to the Token Endpoint using the HTTP Basic method, as described in 2.3.1 of OAuth 2.0. +func isOIDCTokenAuth(req *http.Request) bool { + return req.URL.Path == "/konnect/v1/token" +} + +func isUnprotectedPath(r *http.Request) bool { + if _, ok := _unprotectedPaths[r.URL.Path]; ok { + return true + } + for _, p := range _unprotectedPathPrefixes { + if strings.HasPrefix(r.URL.Path, p) { + return true + } + } + return false +} + +func isPublicPath(p string) bool { + for _, pp := range _publicPaths { + if strings.HasPrefix(p, pp) { + return true + } + } + return false +} + // configureSupportedChallenges adds known authentication challenges to the current session. func configureSupportedChallenges(options Options) { if options.OIDCIss != "" { @@ -66,13 +180,23 @@ func configureSupportedChallenges(options Options) { } func writeSupportedAuthenticateHeader(w http.ResponseWriter, r *http.Request) { - for i := 0; i < len(SupportedAuthStrategies); i++ { - w.Header().Add(WWWAuthenticate, fmt.Sprintf("%v realm=\"%s\", charset=\"UTF-8\"", strings.Title(SupportedAuthStrategies[i]), r.Host)) + caser := cases.Title(language.Und) + for _, s := range SupportedAuthStrategies { + w.Header().Add(WwwAuthenticate, fmt.Sprintf("%v realm=\"%s\", charset=\"UTF-8\"", caser.String(s), r.Host)) } } func removeSuperfluousAuthenticate(w http.ResponseWriter) { - w.Header().Del(WWWAuthenticate) + w.Header().Del(WwwAuthenticate) +} + +// userAgentLocker aids in dependency injection for helper methods. The set of fields is arbitrary and the only relation +// they share is to fulfill their duty and lock a User-Agent to its correct challenge if configured. +type userAgentLocker struct { + w http.ResponseWriter + r *http.Request + locks map[string]string // locks represents a reva user-agent:challenge mapping. + fallback string } // userAgentAuthenticateLockIn sets Www-Authenticate according to configured user agents. This is useful for the case of @@ -86,49 +210,22 @@ func userAgentAuthenticateLockIn(w http.ResponseWriter, r *http.Request, locks m fallback: fallback, } - for i := 0; i < len(ProxyWwwAuthenticate); i++ { - evalRequestURI(&u, i) + for _, r := range ProxyWwwAuthenticate { + evalRequestURI(u, r) } } -func evalRequestURI(l *userAgentLocker, i int) { - r := regexp.MustCompile(ProxyWwwAuthenticate[i]) - if r.Match([]byte(l.r.RequestURI)) { - for k, v := range l.locks { - if strings.Contains(k, l.r.UserAgent()) { - removeSuperfluousAuthenticate(l.w) - l.w.Header().Add(WWWAuthenticate, fmt.Sprintf("%v realm=\"%s\", charset=\"UTF-8\"", strings.Title(v), l.r.Host)) - return - } +func evalRequestURI(l userAgentLocker, r regexp.Regexp) { + if !r.MatchString(l.r.RequestURI) { + return + } + caser := cases.Title(language.Und) + for k, v := range l.locks { + if strings.Contains(k, l.r.UserAgent()) { + removeSuperfluousAuthenticate(l.w) + l.w.Header().Add(WwwAuthenticate, fmt.Sprintf("%v realm=\"%s\", charset=\"UTF-8\"", caser.String(v), l.r.Host)) + return } - l.w.Header().Add(WWWAuthenticate, fmt.Sprintf("%v realm=\"%s\", charset=\"UTF-8\"", strings.Title(l.fallback), l.r.Host)) } -} - -// newOIDCAuth returns a configured oidc middleware -func newOIDCAuth(options Options) func(http.Handler) http.Handler { - return OIDCAuth( - Logger(options.Logger), - OIDCProviderFunc(options.OIDCProviderFunc), - HTTPClient(options.HTTPClient), - OIDCIss(options.OIDCIss), - TokenCacheSize(options.UserinfoCacheSize), - TokenCacheTTL(options.UserinfoCacheTTL), - CredentialsByUserAgent(options.CredentialsByUserAgent), - AccessTokenVerifyMethod(options.AccessTokenVerifyMethod), - JWKSOptions(options.JWKS), - ) -} - -// newBasicAuth returns a configured basic middleware -func newBasicAuth(options Options) func(http.Handler) http.Handler { - return BasicAuth( - UserProvider(options.UserProvider), - Logger(options.Logger), - EnableBasicAuth(options.EnableBasicAuth), - OIDCIss(options.OIDCIss), - UserOIDCClaim(options.UserOIDCClaim), - UserCS3Claim(options.UserCS3Claim), - CredentialsByUserAgent(options.CredentialsByUserAgent), - ) + l.w.Header().Add(WwwAuthenticate, fmt.Sprintf("%v realm=\"%s\", charset=\"UTF-8\"", caser.String(l.fallback), l.r.Host)) } diff --git a/services/proxy/pkg/middleware/authentication_test.go b/services/proxy/pkg/middleware/authentication_test.go new file mode 100644 index 00000000000..1188fefa343 --- /dev/null +++ b/services/proxy/pkg/middleware/authentication_test.go @@ -0,0 +1,19 @@ +package middleware + +import ( + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" +) + +var _ = Describe("authentication helpers", func() { + DescribeTable("isPublicPath should recognize public paths", + func(input string, expected bool) { + isPublic := isPublicPath(input) + Expect(isPublic).To(Equal(expected)) + }, + Entry("public files path", "/remote.php/dav/public-files/", true), + Entry("public files path without remote.php", "/remote.php/dav/public-files/", true), + Entry("token info path", "/remote.php/ocs/apps/files_sharing/api/v1/tokeninfo/unprotected", true), + Entry("capabilities", "/ocs/v1.php/cloud/capabilities", true), + ) +}) diff --git a/services/proxy/pkg/middleware/basic_auth.go b/services/proxy/pkg/middleware/basic_auth.go index b7d480d87bc..913e7404865 100644 --- a/services/proxy/pkg/middleware/basic_auth.go +++ b/services/proxy/pkg/middleware/basic_auth.go @@ -1,145 +1,62 @@ package middleware import ( - "fmt" "net/http" - "strings" "github.com/owncloud/ocis/v2/ocis-pkg/log" "github.com/owncloud/ocis/v2/ocis-pkg/oidc" "github.com/owncloud/ocis/v2/services/proxy/pkg/user/backend" - "github.com/owncloud/ocis/v2/services/proxy/pkg/webdav" ) -// BasicAuth provides a middleware to check if BasicAuth is provided -func BasicAuth(optionSetters ...Option) func(next http.Handler) http.Handler { - options := newOptions(optionSetters...) - logger := options.Logger - - if options.EnableBasicAuth { - options.Logger.Warn().Msg("basic auth enabled, use only for testing or development") - } - - h := basicAuth{ - logger: logger, - enabled: options.EnableBasicAuth, - userProvider: options.UserProvider, - } - - return func(next http.Handler) http.Handler { - return http.HandlerFunc( - func(w http.ResponseWriter, req *http.Request) { - if h.isPublicLink(req) || !h.isBasicAuth(req) || h.isOIDCTokenAuth(req) { - if !h.isPublicLink(req) { - userAgentAuthenticateLockIn(w, req, options.CredentialsByUserAgent, "basic") - } - next.ServeHTTP(w, req) - return - } - - removeSuperfluousAuthenticate(w) - login, password, _ := req.BasicAuth() - user, _, err := h.userProvider.Authenticate(req.Context(), login, password) - - // touch is a user agent locking guard, when touched changes to true it indicates the User-Agent on the - // request is configured to support only one challenge, it it remains untouched, there are no considera- - // tions and we should write all available authentication challenges to the response. - touch := false - - if err != nil { - for k, v := range options.CredentialsByUserAgent { - if strings.Contains(k, req.UserAgent()) { - removeSuperfluousAuthenticate(w) - w.Header().Add("Www-Authenticate", fmt.Sprintf("%v realm=\"%s\", charset=\"UTF-8\"", strings.Title(v), req.Host)) - touch = true - break - } - } - - // if the request is not bound to any user agent, write all available challenges - if !touch { - writeSupportedAuthenticateHeader(w, req) - } - - // if the request is a PROPFIND return a WebDAV error code. - // TODO: The proxy has to be smart enough to detect when a request is directed towards a webdav server - // and react accordingly. - - w.WriteHeader(http.StatusUnauthorized) - - if webdav.IsWebdavRequest(req) { - b, err := webdav.Marshal(webdav.Exception{ - Code: webdav.SabredavPermissionDenied, - Message: "Authentication error", - }) - - webdav.HandleWebdavError(w, b, err) - return - } - - return - } - - // fake oidc claims - claims := map[string]interface{}{ - oidc.Iss: user.Id.Idp, - oidc.PreferredUsername: user.Username, - oidc.Email: user.Mail, - oidc.OwncloudUUID: user.Id.OpaqueId, - } - - if options.UserCS3Claim == "userid" { - // set the custom user claim only if users will be looked up by the userid on the CS3api - // OpaqueId contains the userid configured in STORAGE_LDAP_USER_SCHEMA_UID - claims[options.UserOIDCClaim] = user.Id.OpaqueId - - } - - next.ServeHTTP(w, req.WithContext(oidc.NewContext(req.Context(), claims))) - }, - ) - } +// BasicAuthenticator is the authenticator responsible for HTTP Basic authentication. +type BasicAuthenticator struct { + Logger log.Logger + UserProvider backend.UserBackend + UserCS3Claim string + UserOIDCClaim string } -type basicAuth struct { - logger log.Logger - enabled bool - userProvider backend.UserBackend -} - -func (m basicAuth) isPublicLink(req *http.Request) bool { - login, _, ok := req.BasicAuth() - - if !ok || login != "public" { - return false +// Authenticate implements the authenticator interface to authenticate requests via basic auth. +func (m BasicAuthenticator) Authenticate(r *http.Request) (*http.Request, bool) { + if isPublicPath(r.URL.Path) { + // The authentication of public path requests is handled by another authenticator. + // Since we can't guarantee the order of execution of the authenticators, we better + // implement an early return here for paths we can't authenticate in this authenticator. + return nil, false } - publicPaths := []string{ - "/dav/public-files/", - "/remote.php/dav/public-files/", - "/remote.php/ocs/apps/files_sharing/api/v1/tokeninfo/unprotected", - "/ocs/v1.php/cloud/capabilities", - "/data", - } - isPublic := false - - for _, p := range publicPaths { - if strings.HasPrefix(req.URL.Path, p) { - isPublic = true - break - } + login, password, ok := r.BasicAuth() + if !ok { + return nil, false } - return isPublic -} + user, _, err := m.UserProvider.Authenticate(r.Context(), login, password) + if err != nil { + m.Logger.Error(). + Err(err). + Str("authenticator", "basic"). + Str("path", r.URL.Path). + Msg("failed to authenticate request") + return nil, false + } -// The token auth endpoint uses basic auth for clients, see https://openid.net/specs/openid-connect-basic-1_0.html#TokenRequest -// > The Client MUST authenticate to the Token Endpoint using the HTTP Basic method, as described in 2.3.1 of OAuth 2.0. -func (m basicAuth) isOIDCTokenAuth(req *http.Request) bool { - return req.URL.Path == "/konnect/v1/token" -} + // fake oidc claims + claims := map[string]interface{}{ + oidc.Iss: user.Id.Idp, + oidc.PreferredUsername: user.Username, + oidc.Email: user.Mail, + oidc.OwncloudUUID: user.Id.OpaqueId, + } -func (m basicAuth) isBasicAuth(req *http.Request) bool { - _, _, ok := req.BasicAuth() - return m.enabled && ok + if m.UserCS3Claim == "userid" { + // set the custom user claim only if users will be looked up by the userid on the CS3api + // OpaqueId contains the userid configured in STORAGE_LDAP_USER_SCHEMA_UID + claims[m.UserOIDCClaim] = user.Id.OpaqueId + + } + m.Logger.Debug(). + Str("authenticator", "basic"). + Str("path", r.URL.Path). + Msg("successfully authenticated request") + return r.WithContext(oidc.NewContext(r.Context(), claims)), true } diff --git a/services/proxy/pkg/middleware/basic_auth_test.go b/services/proxy/pkg/middleware/basic_auth_test.go index 46c7f48285e..fcc2e6f3ce0 100644 --- a/services/proxy/pkg/middleware/basic_auth_test.go +++ b/services/proxy/pkg/middleware/basic_auth_test.go @@ -1,40 +1,68 @@ package middleware import ( + "context" + "net/http" "net/http/httptest" - "testing" + + userv1beta1 "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1" + . "github.com/onsi/ginkgo/v2" + + . "github.com/onsi/gomega" + "github.com/owncloud/ocis/v2/ocis-pkg/log" + "github.com/owncloud/ocis/v2/ocis-pkg/oidc" + "github.com/owncloud/ocis/v2/services/proxy/pkg/user/backend" + "github.com/owncloud/ocis/v2/services/proxy/pkg/user/backend/test" ) -/**/ - -func TestBasicAuth__isPublicLink(t *testing.T) { - tests := []struct { - url string - username string - expected bool - }{ - {url: "/remote.php/dav/public-files/", username: "", expected: false}, - {url: "/remote.php/dav/public-files/", username: "abc", expected: false}, - {url: "/remote.php/dav/public-files/", username: "private", expected: false}, - {url: "/remote.php/dav/public-files/", username: "public", expected: true}, - {url: "/ocs/v1.php/cloud/capabilities", username: "", expected: false}, - {url: "/ocs/v1.php/cloud/capabilities", username: "abc", expected: false}, - {url: "/ocs/v1.php/cloud/capabilities", username: "private", expected: false}, - {url: "/ocs/v1.php/cloud/capabilities", username: "public", expected: true}, - {url: "/ocs/v1.php/cloud/users/admin", username: "public", expected: false}, - } - ba := basicAuth{} - - for _, tt := range tests { - req := httptest.NewRequest("", tt.url, nil) - - if tt.username != "" { - req.SetBasicAuth(tt.username, "") +var _ = Describe("Authenticating requests", Label("BasicAuthenticator"), func() { + var authenticator Authenticator + BeforeEach(func() { + authenticator = BasicAuthenticator{ + Logger: log.NewLogger(), + UserProvider: &test.UserBackendMock{ + AuthenticateFunc: func(ctx context.Context, username, password string) (*userv1beta1.User, string, error) { + var user *userv1beta1.User + if username == "testuser" && password == "testpassword" { + user = &userv1beta1.User{ + Id: &userv1beta1.UserId{ + Idp: "IdpId", + OpaqueId: "OpaqueId", + }, + Username: "testuser", + Mail: "testuser@example.com", + } + return user, "", nil + } + return nil, "", backend.ErrAccountNotFound + }, + }, } + }) - result := ba.isPublicLink(req) - if result != tt.expected { - t.Errorf("with %s expected %t got %t", tt.url, tt.expected, result) - } - } -} + When("the request contains correct data", func() { + It("should successfully authenticate", func() { + req := httptest.NewRequest(http.MethodGet, "http://example.com/example/path", http.NoBody) + req.SetBasicAuth("testuser", "testpassword") + + req2, valid := authenticator.Authenticate(req) + + Expect(valid).To(Equal(true)) + Expect(req2).ToNot(BeNil()) + }) + It("adds claims to the request context", func() { + req := httptest.NewRequest(http.MethodGet, "http://example.com/example/path", http.NoBody) + req.SetBasicAuth("testuser", "testpassword") + + req2, valid := authenticator.Authenticate(req) + Expect(valid).To(Equal(true)) + + claims := oidc.FromContext(req2.Context()) + Expect(claims).ToNot(BeNil()) + Expect(claims[oidc.Iss]).To(Equal("IdpId")) + Expect(claims[oidc.PreferredUsername]).To(Equal("testuser")) + Expect(claims[oidc.Email]).To(Equal("testuser@example.com")) + Expect(claims[oidc.OwncloudUUID]).To(Equal("OpaqueId")) + }) + }) +}) diff --git a/services/proxy/pkg/middleware/middleware_suite_test.go b/services/proxy/pkg/middleware/middleware_suite_test.go new file mode 100644 index 00000000000..09e4e113609 --- /dev/null +++ b/services/proxy/pkg/middleware/middleware_suite_test.go @@ -0,0 +1,13 @@ +package middleware_test + +import ( + "testing" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" +) + +func TestMiddleware(t *testing.T) { + RegisterFailHandler(Fail) + RunSpecs(t, "Middleware Suite") +} diff --git a/services/proxy/pkg/middleware/oidc_auth.go b/services/proxy/pkg/middleware/oidc_auth.go index ae3b313f086..c89f83d5ccd 100644 --- a/services/proxy/pkg/middleware/oidc_auth.go +++ b/services/proxy/pkg/middleware/oidc_auth.go @@ -3,7 +3,6 @@ package middleware import ( "context" "encoding/json" - "errors" "io/ioutil" "net/http" "strings" @@ -17,90 +16,63 @@ import ( "github.com/owncloud/ocis/v2/ocis-pkg/oidc" osync "github.com/owncloud/ocis/v2/ocis-pkg/sync" "github.com/owncloud/ocis/v2/services/proxy/pkg/config" + "github.com/pkg/errors" "golang.org/x/oauth2" ) +const ( + _headerAuthorization = "Authorization" + _bearerPrefix = "Bearer " +) + // OIDCProvider used to mock the oidc provider during tests type OIDCProvider interface { UserInfo(ctx context.Context, ts oauth2.TokenSource) (*gOidc.UserInfo, error) } -// OIDCAuth provides a middleware to check access secured by a static token. -func OIDCAuth(optionSetters ...Option) func(next http.Handler) http.Handler { - options := newOptions(optionSetters...) - tokenCache := osync.NewCache(options.UserinfoCacheSize) - - h := oidcAuth{ - logger: options.Logger, - providerFunc: options.OIDCProviderFunc, - httpClient: options.HTTPClient, - oidcIss: options.OIDCIss, +// NewOIDCAuthenticator returns a ready to use authenticator which can handle OIDC authentication. +func NewOIDCAuthenticator(logger log.Logger, tokenCacheTTL int, oidcHTTPClient *http.Client, oidcIss string, providerFunc func() (OIDCProvider, error), + jwksOptions config.JWKS, accessTokenVerifyMethod string) OIDCAuthenticator { + tokenCache := osync.NewCache(tokenCacheTTL) + return OIDCAuthenticator{ + Logger: logger, tokenCache: &tokenCache, - tokenCacheTTL: options.UserinfoCacheTTL, - accessTokenVerifyMethod: options.AccessTokenVerifyMethod, - jwksOptions: options.JWKS, - jwksLock: &sync.Mutex{}, + TokenCacheTTL: time.Duration(tokenCacheTTL), + HTTPClient: oidcHTTPClient, + OIDCIss: oidcIss, + ProviderFunc: providerFunc, + JWKSOptions: jwksOptions, + AccessTokenVerifyMethod: accessTokenVerifyMethod, providerLock: &sync.Mutex{}, - } - - return func(next http.Handler) http.Handler { - return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { - // there is no bearer token on the request, - if !h.shouldServe(req) { - // oidc supported but token not present, add header and handover to the next middleware. - userAgentAuthenticateLockIn(w, req, options.CredentialsByUserAgent, "bearer") - next.ServeHTTP(w, req) - return - } - - if h.getProvider() == nil { - w.WriteHeader(http.StatusInternalServerError) - return - } - - // Force init of jwks keyfunc if needed (contacts the .well-known and jwks endpoints on first call) - if h.accessTokenVerifyMethod == config.AccessTokenVerificationJWT && h.getKeyfunc() == nil { - w.WriteHeader(http.StatusInternalServerError) - return - } - - token := strings.TrimPrefix(req.Header.Get("Authorization"), "Bearer ") - - claims, status := h.getClaims(token, req) - if status != 0 { - w.WriteHeader(status) - return - } - - // inject claims to the request context for the account_resolver middleware. - next.ServeHTTP(w, req.WithContext(oidc.NewContext(req.Context(), claims))) - }) + jwksLock: &sync.Mutex{}, } } -type oidcAuth struct { - logger log.Logger - provider OIDCProvider - providerLock *sync.Mutex - jwksOptions config.JWKS - jwks *keyfunc.JWKS - jwksLock *sync.Mutex - providerFunc func() (OIDCProvider, error) - httpClient *http.Client - oidcIss string +// OIDCAuthenticator is an authenticator responsible for OIDC authentication. +type OIDCAuthenticator struct { + Logger log.Logger + HTTPClient *http.Client + OIDCIss string tokenCache *osync.Cache - tokenCacheTTL time.Duration - accessTokenVerifyMethod string + TokenCacheTTL time.Duration + ProviderFunc func() (OIDCProvider, error) + AccessTokenVerifyMethod string + JWKSOptions config.JWKS + + providerLock *sync.Mutex + provider OIDCProvider + + jwksLock *sync.Mutex + JWKS *keyfunc.JWKS } -func (m oidcAuth) getClaims(token string, req *http.Request) (claims map[string]interface{}, status int) { +func (m OIDCAuthenticator) getClaims(token string, req *http.Request) (map[string]interface{}, error) { + var claims map[string]interface{} hit := m.tokenCache.Load(token) if hit == nil { aClaims, err := m.verifyAccessToken(token) if err != nil { - m.logger.Error().Err(err).Msg("Failed to verify access token") - status = http.StatusUnauthorized - return + return nil, errors.Wrap(err, "failed to verify access token") } oauth2Token := &oauth2.Token{ @@ -108,52 +80,46 @@ func (m oidcAuth) getClaims(token string, req *http.Request) (claims map[string] } userInfo, err := m.getProvider().UserInfo( - context.WithValue(req.Context(), oauth2.HTTPClient, m.httpClient), + context.WithValue(req.Context(), oauth2.HTTPClient, m.HTTPClient), oauth2.StaticTokenSource(oauth2Token), ) if err != nil { - m.logger.Error().Err(err).Msg("Failed to get userinfo") - status = http.StatusUnauthorized - return + return nil, errors.Wrap(err, "failed to get userinfo") } - if err := userInfo.Claims(&claims); err != nil { - m.logger.Error().Err(err).Interface("userinfo", userInfo).Msg("failed to unmarshal userinfo claims") - status = http.StatusInternalServerError - return + return nil, errors.Wrap(err, "failed to unmarshal userinfo claims") } expiration := m.extractExpiration(aClaims) m.tokenCache.Store(token, claims, expiration) - m.logger.Debug().Interface("claims", claims).Interface("userInfo", userInfo).Time("expiration", expiration.UTC()).Msg("unmarshalled and cached userinfo") - return + m.Logger.Debug().Interface("claims", claims).Interface("userInfo", userInfo).Time("expiration", expiration.UTC()).Msg("unmarshalled and cached userinfo") + return claims, nil } var ok bool if claims, ok = hit.V.(map[string]interface{}); !ok { - status = http.StatusInternalServerError - return + return nil, errors.New("failed to cast claims from the cache") } - m.logger.Debug().Interface("claims", claims).Msg("cache hit for userinfo") - return + m.Logger.Debug().Interface("claims", claims).Msg("cache hit for userinfo") + return claims, nil } -func (m oidcAuth) verifyAccessToken(token string) (jwt.RegisteredClaims, error) { - switch m.accessTokenVerifyMethod { +func (m OIDCAuthenticator) verifyAccessToken(token string) (jwt.RegisteredClaims, error) { + switch m.AccessTokenVerifyMethod { case config.AccessTokenVerificationJWT: return m.verifyAccessTokenJWT(token) case config.AccessTokenVerificationNone: - m.logger.Debug().Msg("Access Token verification disabled") + m.Logger.Debug().Msg("Access Token verification disabled") return jwt.RegisteredClaims{}, nil default: - m.logger.Error().Str("access_token_verify_method", m.accessTokenVerifyMethod).Msg("Unknown Access Token verification setting") + m.Logger.Error().Str("access_token_verify_method", m.AccessTokenVerifyMethod).Msg("Unknown Access Token verification setting") return jwt.RegisteredClaims{}, errors.New("Unknown Access Token Verification method") } } // verifyAccessTokenJWT tries to parse and verify the access token as a JWT. -func (m oidcAuth) verifyAccessTokenJWT(token string) (jwt.RegisteredClaims, error) { +func (m OIDCAuthenticator) verifyAccessTokenJWT(token string) (jwt.RegisteredClaims, error) { var claims jwt.RegisteredClaims jwks := m.getKeyfunc() if jwks == nil { @@ -161,13 +127,13 @@ func (m oidcAuth) verifyAccessTokenJWT(token string) (jwt.RegisteredClaims, erro } _, err := jwt.ParseWithClaims(token, &claims, jwks.Keyfunc) - m.logger.Debug().Interface("access token", &claims).Msg("parsed access token") + m.Logger.Debug().Interface("access token", &claims).Msg("parsed access token") if err != nil { - m.logger.Info().Err(err).Msg("Failed to parse/verify the access token.") + m.Logger.Info().Err(err).Msg("Failed to parse/verify the access token.") return claims, err } - if !claims.VerifyIssuer(m.oidcIss, true) { + if !claims.VerifyIssuer(m.OIDCIss, true) { vErr := jwt.ValidationError{} vErr.Inner = jwt.ErrTokenInvalidIssuer vErr.Errors |= jwt.ValidationErrorIssuer @@ -180,89 +146,80 @@ func (m oidcAuth) verifyAccessTokenJWT(token string) (jwt.RegisteredClaims, erro // extractExpiration tries to extract the expriration time from the access token // If the access token does not have an exp claim it will fallback to the configured // default expiration -func (m oidcAuth) extractExpiration(aClaims jwt.RegisteredClaims) time.Time { - defaultExpiration := time.Now().Add(m.tokenCacheTTL) +func (m OIDCAuthenticator) extractExpiration(aClaims jwt.RegisteredClaims) time.Time { + defaultExpiration := time.Now().Add(m.TokenCacheTTL) if aClaims.ExpiresAt != nil { - m.logger.Debug().Str("exp", aClaims.ExpiresAt.String()).Msg("Expiration Time from access_token") + m.Logger.Debug().Str("exp", aClaims.ExpiresAt.String()).Msg("Expiration Time from access_token") return aClaims.ExpiresAt.Time } return defaultExpiration } -func (m oidcAuth) shouldServe(req *http.Request) bool { - header := req.Header.Get("Authorization") - - if m.oidcIss == "" { +func (m OIDCAuthenticator) shouldServe(req *http.Request) bool { + if m.OIDCIss == "" { return false } - // todo: looks dirty, check later - // TODO: make a PR to coreos/go-oidc for exposing userinfo endpoint on provider, see https://github.com/coreos/go-oidc/issues/248 - for _, ignoringPath := range []string{"/konnect/v1/userinfo", "/status.php"} { - if req.URL.Path == ignoringPath { - return false - } - } - - return strings.HasPrefix(header, "Bearer ") + header := req.Header.Get(_headerAuthorization) + return strings.HasPrefix(header, _bearerPrefix) } type jwksJSON struct { JWKSURL string `json:"jwks_uri"` } -func (m *oidcAuth) getKeyfunc() *keyfunc.JWKS { +func (m OIDCAuthenticator) getKeyfunc() *keyfunc.JWKS { m.jwksLock.Lock() defer m.jwksLock.Unlock() - if m.jwks == nil { - wellKnown := strings.TrimSuffix(m.oidcIss, "/") + "/.well-known/openid-configuration" + if m.JWKS == nil { + wellKnown := strings.TrimSuffix(m.OIDCIss, "/") + "/.well-known/openid-configuration" - resp, err := m.httpClient.Get(wellKnown) + resp, err := m.HTTPClient.Get(wellKnown) if err != nil { - m.logger.Error().Err(err).Msg("Failed to set request for .well-known/openid-configuration") + m.Logger.Error().Err(err).Msg("Failed to set request for .well-known/openid-configuration") return nil } defer resp.Body.Close() body, err := ioutil.ReadAll(resp.Body) if err != nil { - m.logger.Error().Err(err).Msg("unable to read discovery response body") + m.Logger.Error().Err(err).Msg("unable to read discovery response body") return nil } if resp.StatusCode != http.StatusOK { - m.logger.Error().Str("status", resp.Status).Str("body", string(body)).Msg("error requesting openid-configuration") + m.Logger.Error().Str("status", resp.Status).Str("body", string(body)).Msg("error requesting openid-configuration") return nil } var j jwksJSON err = json.Unmarshal(body, &j) if err != nil { - m.logger.Error().Err(err).Msg("failed to decode provider openid-configuration") + m.Logger.Error().Err(err).Msg("failed to decode provider openid-configuration") return nil } - m.logger.Debug().Str("jwks", j.JWKSURL).Msg("discovered jwks endpoint") + m.Logger.Debug().Str("jwks", j.JWKSURL).Msg("discovered jwks endpoint") options := keyfunc.Options{ - Client: m.httpClient, + Client: m.HTTPClient, RefreshErrorHandler: func(err error) { - m.logger.Error().Err(err).Msg("There was an error with the jwt.Keyfunc") + m.Logger.Error().Err(err).Msg("There was an error with the jwt.Keyfunc") }, - RefreshInterval: time.Minute * time.Duration(m.jwksOptions.RefreshInterval), - RefreshRateLimit: time.Second * time.Duration(m.jwksOptions.RefreshRateLimit), - RefreshTimeout: time.Second * time.Duration(m.jwksOptions.RefreshTimeout), - RefreshUnknownKID: m.jwksOptions.RefreshUnknownKID, + RefreshInterval: time.Minute * time.Duration(m.JWKSOptions.RefreshInterval), + RefreshRateLimit: time.Second * time.Duration(m.JWKSOptions.RefreshRateLimit), + RefreshTimeout: time.Second * time.Duration(m.JWKSOptions.RefreshTimeout), + RefreshUnknownKID: m.JWKSOptions.RefreshUnknownKID, } - m.jwks, err = keyfunc.Get(j.JWKSURL, options) + m.JWKS, err = keyfunc.Get(j.JWKSURL, options) if err != nil { - m.jwks = nil - m.logger.Error().Err(err).Msg("Failed to create JWKS from resource at the given URL.") + m.JWKS = nil + m.Logger.Error().Err(err).Msg("Failed to create JWKS from resource at the given URL.") return nil } } - return m.jwks + return m.JWKS } -func (m *oidcAuth) getProvider() OIDCProvider { +func (m OIDCAuthenticator) getProvider() OIDCProvider { m.providerLock.Lock() defer m.providerLock.Unlock() if m.provider == nil { @@ -271,9 +228,9 @@ func (m *oidcAuth) getProvider() OIDCProvider { // provider needs to be cached as when it is created // it will fetch the keys from the issuer using the .well-known // endpoint - provider, err := m.providerFunc() + provider, err := m.ProviderFunc() if err != nil { - m.logger.Error().Err(err).Msg("could not initialize oidcAuth provider") + m.Logger.Error().Err(err).Msg("could not initialize oidcAuth provider") return nil } @@ -281,3 +238,39 @@ func (m *oidcAuth) getProvider() OIDCProvider { } return m.provider } + +// Authenticate implements the authenticator interface to authenticate requests via oidc auth. +func (m OIDCAuthenticator) Authenticate(r *http.Request) (*http.Request, bool) { + // there is no bearer token on the request, + if !m.shouldServe(r) || isPublicPath(r.URL.Path) { + // The authentication of public path requests is handled by another authenticator. + // Since we can't guarantee the order of execution of the authenticators, we better + // implement an early return here for paths we can't authenticate in this authenticator. + return nil, false + } + + if m.getProvider() == nil { + return nil, false + } + + // Force init of jwks keyfunc if needed (contacts the .well-known and jwks endpoints on first call) + if m.AccessTokenVerifyMethod == config.AccessTokenVerificationJWT && m.getKeyfunc() == nil { + return nil, false + } + token := strings.TrimPrefix(r.Header.Get(_headerAuthorization), _bearerPrefix) + + claims, err := m.getClaims(token, r) + if err != nil { + m.Logger.Error(). + Err(err). + Str("authenticator", "oidc"). + Str("path", r.URL.Path). + Msg("failed to authenticate the request") + return nil, false + } + m.Logger.Debug(). + Str("authenticator", "oidc"). + Str("path", r.URL.Path). + Msg("successfully authenticated request") + return r.WithContext(oidc.NewContext(r.Context(), claims)), true +} diff --git a/services/proxy/pkg/middleware/oidc_auth_test.go b/services/proxy/pkg/middleware/oidc_auth_test.go deleted file mode 100644 index 6b7e97bceb5..00000000000 --- a/services/proxy/pkg/middleware/oidc_auth_test.go +++ /dev/null @@ -1,69 +0,0 @@ -package middleware - -import ( - "context" - "fmt" - "net/http" - "net/http/httptest" - "testing" - - "github.com/coreos/go-oidc/v3/oidc" - "github.com/owncloud/ocis/v2/ocis-pkg/log" - "github.com/owncloud/ocis/v2/services/proxy/pkg/config" - "golang.org/x/oauth2" -) - -func TestOIDCAuthMiddleware(t *testing.T) { - next := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {}) - - m := OIDCAuth( - Logger(log.NewLogger()), - OIDCProviderFunc(func() (OIDCProvider, error) { - return mockOP(false), nil - }), - OIDCIss("https://localhost:9200"), - AccessTokenVerifyMethod(config.AccessTokenVerificationNone), - )(next) - - r := httptest.NewRequest(http.MethodGet, "https://idp.example.com", nil) - r.Header.Set("Authorization", "Bearer sometoken") - w := httptest.NewRecorder() - m.ServeHTTP(w, r) - - if w.Code != http.StatusInternalServerError { - t.Errorf("expected an internal server error") - } -} - -type mockOIDCProvider struct { - UserInfoFunc func(ctx context.Context, ts oauth2.TokenSource) (*oidc.UserInfo, error) -} - -// UserInfo will panic if the function has been called, but not mocked -func (m mockOIDCProvider) UserInfo(ctx context.Context, ts oauth2.TokenSource) (*oidc.UserInfo, error) { - if m.UserInfoFunc != nil { - return m.UserInfoFunc(ctx, ts) - } - - panic("UserInfo was called in test but not mocked") -} - -func mockOP(retErr bool) OIDCProvider { - if retErr { - return &mockOIDCProvider{ - UserInfoFunc: func(ctx context.Context, ts oauth2.TokenSource) (*oidc.UserInfo, error) { - return nil, fmt.Errorf("error returned by mockOIDCProvider UserInfo") - }, - } - - } - return &mockOIDCProvider{ - UserInfoFunc: func(ctx context.Context, ts oauth2.TokenSource) (*oidc.UserInfo, error) { - ui := &oidc.UserInfo{ - // claims: private ... - } - return ui, nil - }, - } - -} diff --git a/services/proxy/pkg/middleware/public_share_auth.go b/services/proxy/pkg/middleware/public_share_auth.go index 9b3ddcd5ffd..8f82bf72031 100644 --- a/services/proxy/pkg/middleware/public_share_auth.go +++ b/services/proxy/pkg/middleware/public_share_auth.go @@ -5,68 +5,83 @@ import ( "strings" gateway "github.com/cs3org/go-cs3apis/cs3/gateway/v1beta1" + "github.com/owncloud/ocis/v2/ocis-pkg/log" ) const ( - headerRevaAccessToken = "x-access-token" + _headerRevaAccessToken = "x-access-token" headerShareToken = "public-token" basicAuthPasswordPrefix = "password|" authenticationType = "publicshares" + + _paramSignature = "signature" + _paramExpiration = "expiration" ) -// PublicShareAuth ... -func PublicShareAuth(opts ...Option) func(next http.Handler) http.Handler { - options := newOptions(opts...) - logger := options.Logger - - return func(next http.Handler) http.Handler { - return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - shareToken := r.Header.Get(headerShareToken) - if shareToken == "" { - shareToken = r.URL.Query().Get(headerShareToken) - } - - // Currently we only want to authenticate app open request coming from public shares. - if shareToken == "" { - // Don't authenticate - next.ServeHTTP(w, r) - return - } - - var sharePassword string - if signature := r.URL.Query().Get("signature"); signature != "" { - expiration := r.URL.Query().Get("expiration") - if expiration == "" { - logger.Warn().Str("signature", signature).Msg("cannot do signature auth without the expiration") - next.ServeHTTP(w, r) - return - } - sharePassword = strings.Join([]string{"signature", signature, expiration}, "|") - } else { - // We can ignore the username since it is always set to "public" in public shares. - _, password, ok := r.BasicAuth() - - sharePassword = basicAuthPasswordPrefix - if ok { - sharePassword += password - } - } - - authResp, err := options.RevaGatewayClient.Authenticate(r.Context(), &gateway.AuthenticateRequest{ - Type: authenticationType, - ClientId: shareToken, - ClientSecret: sharePassword, - }) - - if err != nil { - logger.Debug().Err(err).Str("public_share_token", shareToken).Msg("could not authenticate public share") - // try another middleware - next.ServeHTTP(w, r) - return - } - - r.Header.Add(headerRevaAccessToken, authResp.Token) - next.ServeHTTP(w, r) - }) - } +// PublicShareAuthenticator is the authenticator which can authenticate public share requests. +// It will add the share owner into the request context. +type PublicShareAuthenticator struct { + Logger log.Logger + RevaGatewayClient gateway.GatewayAPIClient +} + +// Authenticate implements the authenticator interface to authenticate requests via public share auth. +func (a PublicShareAuthenticator) Authenticate(r *http.Request) (*http.Request, bool) { + if !isPublicPath(r.URL.Path) { + return nil, false + } + + query := r.URL.Query() + shareToken := r.Header.Get(headerShareToken) + if shareToken == "" { + shareToken = query.Get(headerShareToken) + } + + if shareToken == "" { + // If the share token is not set then we don't need to inject the user to + // the request context so we can just continue with the request. + return r, true + } + + var sharePassword string + if signature := query.Get(_paramSignature); signature != "" { + expiration := query.Get(_paramExpiration) + if expiration == "" { + a.Logger.Warn().Str("signature", signature).Msg("cannot do signature auth without the expiration") + return nil, false + } + sharePassword = strings.Join([]string{"signature", signature, expiration}, "|") + } else { + // We can ignore the username since it is always set to "public" in public shares. + _, password, ok := r.BasicAuth() + + sharePassword = basicAuthPasswordPrefix + if ok { + sharePassword += password + } + } + + authResp, err := a.RevaGatewayClient.Authenticate(r.Context(), &gateway.AuthenticateRequest{ + Type: authenticationType, + ClientId: shareToken, + ClientSecret: sharePassword, + }) + + if err != nil { + a.Logger.Error(). + Err(err). + Str("authenticator", "public_share"). + Str("public_share_token", shareToken). + Str("path", r.URL.Path). + Msg("failed to authenticate request") + return nil, false + } + + r.Header.Add(_headerRevaAccessToken, authResp.Token) + + a.Logger.Debug(). + Str("authenticator", "public_share"). + Str("path", r.URL.Path). + Msg("successfully authenticated request") + return r, true } diff --git a/services/proxy/pkg/middleware/public_share_auth_test.go b/services/proxy/pkg/middleware/public_share_auth_test.go new file mode 100644 index 00000000000..98637988bd6 --- /dev/null +++ b/services/proxy/pkg/middleware/public_share_auth_test.go @@ -0,0 +1,78 @@ +package middleware + +import ( + "context" + "net/http" + "net/http/httptest" + + gatewayv1beta1 "github.com/cs3org/go-cs3apis/cs3/gateway/v1beta1" + rpcv1beta1 "github.com/cs3org/go-cs3apis/cs3/rpc/v1beta1" + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" + "github.com/owncloud/ocis/v2/ocis-pkg/log" + "google.golang.org/grpc" +) + +var _ = Describe("Authenticating requests", Label("PublicShareAuthenticator"), func() { + var authenticator Authenticator + BeforeEach(func() { + authenticator = PublicShareAuthenticator{ + Logger: log.NewLogger(), + RevaGatewayClient: mockGatewayClient{ + AuthenticateFunc: func(authType, clientID, clientSecret string) (string, rpcv1beta1.Code) { + if authType != "publicshares" { + return "", rpcv1beta1.Code_CODE_NOT_FOUND + } + + if clientID == "sharetoken" && (clientSecret == "password|examples3cr3t" || clientSecret == "signature|examplesignature|exampleexpiration") { + return "exampletoken", rpcv1beta1.Code_CODE_OK + } + + return "", rpcv1beta1.Code_CODE_NOT_FOUND + }, + }, + } + }) + When("the request contains correct data", func() { + Context("using password authentication", func() { + It("should successfully authenticate", func() { + req := httptest.NewRequest(http.MethodGet, "http://example.com/dav/public-files/?public-token=sharetoken", http.NoBody) + req.SetBasicAuth("public", "examples3cr3t") + + req2, valid := authenticator.Authenticate(req) + + Expect(valid).To(Equal(true)) + Expect(req2).ToNot(BeNil()) + + h := req2.Header + Expect(h.Get(_headerRevaAccessToken)).To(Equal("exampletoken")) + }) + }) + Context("using signature authentication", func() { + It("should successfully authenticate", func() { + req := httptest.NewRequest(http.MethodGet, "http://example.com/dav/public-files/?public-token=sharetoken&signature=examplesignature&expiration=exampleexpiration", http.NoBody) + + req2, valid := authenticator.Authenticate(req) + + Expect(valid).To(Equal(true)) + Expect(req2).ToNot(BeNil()) + + h := req2.Header + Expect(h.Get(_headerRevaAccessToken)).To(Equal("exampletoken")) + }) + }) + }) +}) + +type mockGatewayClient struct { + gatewayv1beta1.GatewayAPIClient + AuthenticateFunc func(authType, clientID, clientSecret string) (string, rpcv1beta1.Code) +} + +func (c mockGatewayClient) Authenticate(ctx context.Context, in *gatewayv1beta1.AuthenticateRequest, opts ...grpc.CallOption) (*gatewayv1beta1.AuthenticateResponse, error) { + token, code := c.AuthenticateFunc(in.GetType(), in.GetClientId(), in.GetClientSecret()) + return &gatewayv1beta1.AuthenticateResponse{ + Status: &rpcv1beta1.Status{Code: code}, + Token: token, + }, nil +} diff --git a/services/proxy/pkg/middleware/signed_url_auth.go b/services/proxy/pkg/middleware/signed_url_auth.go index d71036d5a7f..793f6d8adca 100644 --- a/services/proxy/pkg/middleware/signed_url_auth.go +++ b/services/proxy/pkg/middleware/signed_url_auth.go @@ -20,61 +20,40 @@ import ( "golang.org/x/crypto/pbkdf2" ) -// SignedURLAuth provides a middleware to check access secured by a signed URL. -func SignedURLAuth(optionSetters ...Option) func(next http.Handler) http.Handler { - options := newOptions(optionSetters...) +const ( + _paramOCSignature = "OC-Signature" + _paramOCCredential = "OC-Credential" + _paramOCDate = "OC-Date" + _paramOCExpires = "OC-Expires" + _paramOCVerb = "OC-Verb" +) - return func(next http.Handler) http.Handler { - return &signedURLAuth{ - next: next, - logger: options.Logger, - preSignedURLConfig: options.PreSignedURLConfig, - store: options.Store, - userProvider: options.UserProvider, - } +var ( + _requiredParams = [...]string{ + _paramOCSignature, + _paramOCCredential, + _paramOCDate, + _paramOCExpires, + _paramOCVerb, } +) + +// SignedURLAuthenticator is the authenticator responsible for authenticating signed URL requests. +type SignedURLAuthenticator struct { + Logger log.Logger + PreSignedURLConfig config.PreSignedURL + UserProvider backend.UserBackend + Store storesvc.StoreService } -type signedURLAuth struct { - next http.Handler - logger log.Logger - preSignedURLConfig config.PreSignedURL - userProvider backend.UserBackend - store storesvc.StoreService -} - -func (m signedURLAuth) ServeHTTP(w http.ResponseWriter, req *http.Request) { - if !m.shouldServe(req) { - m.next.ServeHTTP(w, req) - return - } - - user, _, err := m.userProvider.GetUserByClaims(req.Context(), "username", req.URL.Query().Get("OC-Credential"), true) - if err != nil { - m.logger.Error().Err(err).Msg("Could not get user by claim") - w.WriteHeader(http.StatusInternalServerError) - } - - ctx := revactx.ContextSetUser(req.Context(), user) - - req = req.WithContext(ctx) - - if err := m.validate(req); err != nil { - http.Error(w, "Invalid url signature", http.StatusUnauthorized) - return - } - - m.next.ServeHTTP(w, req) -} - -func (m signedURLAuth) shouldServe(req *http.Request) bool { - if !m.preSignedURLConfig.Enabled { +func (m SignedURLAuthenticator) shouldServe(req *http.Request) bool { + if !m.PreSignedURLConfig.Enabled { return false } - return req.URL.Query().Get("OC-Signature") != "" + return req.URL.Query().Get(_paramOCSignature) != "" } -func (m signedURLAuth) validate(req *http.Request) (err error) { +func (m SignedURLAuthenticator) validate(req *http.Request) (err error) { query := req.URL.Query() if ok, err := m.allRequiredParametersArePresent(query); !ok { @@ -100,20 +79,14 @@ func (m signedURLAuth) validate(req *http.Request) (err error) { return nil } -func (m signedURLAuth) allRequiredParametersArePresent(query url.Values) (ok bool, err error) { +func (m SignedURLAuthenticator) allRequiredParametersArePresent(query url.Values) (ok bool, err error) { // check if required query parameters exist in given request query parameters // OC-Signature - the computed signature - server will verify the request upon this REQUIRED // OC-Credential - defines the user scope (shall we use the owncloud user id here - this might leak internal data ....) REQUIRED // OC-Date - defined the date the url was signed (ISO 8601 UTC) REQUIRED // OC-Expires - defines the expiry interval in seconds (between 1 and 604800 = 7 days) REQUIRED // TODO OC-Verb - defines for which http verb the request is valid - defaults to GET OPTIONAL - for _, p := range []string{ - "OC-Signature", - "OC-Credential", - "OC-Date", - "OC-Expires", - "OC-Verb", - } { + for _, p := range _requiredParams { if query.Get(p) == "" { return false, fmt.Errorf("required %s parameter not found", p) } @@ -122,19 +95,19 @@ func (m signedURLAuth) allRequiredParametersArePresent(query url.Values) (ok boo return true, nil } -func (m signedURLAuth) requestMethodMatches(meth string, query url.Values) (ok bool, err error) { +func (m SignedURLAuthenticator) requestMethodMatches(meth string, query url.Values) (ok bool, err error) { // check if given url query parameter OC-Verb matches given request method - if !strings.EqualFold(meth, query.Get("OC-Verb")) { + if !strings.EqualFold(meth, query.Get(_paramOCVerb)) { return false, errors.New("required OC-Verb parameter did not match request method") } return true, nil } -func (m signedURLAuth) requestMethodIsAllowed(meth string) (ok bool, err error) { +func (m SignedURLAuthenticator) requestMethodIsAllowed(meth string) (ok bool, err error) { // check if given request method is allowed methodIsAllowed := false - for _, am := range m.preSignedURLConfig.AllowedHTTPMethods { + for _, am := range m.PreSignedURLConfig.AllowedHTTPMethods { if strings.EqualFold(meth, am) { methodIsAllowed = true break @@ -147,14 +120,15 @@ func (m signedURLAuth) requestMethodIsAllowed(meth string) (ok bool, err error) return true, nil } -func (m signedURLAuth) urlIsExpired(query url.Values, now func() time.Time) (expired bool, err error) { + +func (m SignedURLAuthenticator) urlIsExpired(query url.Values, now func() time.Time) (expired bool, err error) { // check if url is expired by checking if given date (OC-Date) + expires in seconds (OC-Expires) is after now - validFrom, err := time.Parse(time.RFC3339, query.Get("OC-Date")) + validFrom, err := time.Parse(time.RFC3339, query.Get(_paramOCDate)) if err != nil { return true, err } - requestExpiry, err := time.ParseDuration(query.Get("OC-Expires") + "s") + requestExpiry, err := time.ParseDuration(query.Get(_paramOCExpires) + "s") if err != nil { return true, err } @@ -164,20 +138,20 @@ func (m signedURLAuth) urlIsExpired(query url.Values, now func() time.Time) (exp return !(now().After(validFrom) && now().Before(validTo)), nil } -func (m signedURLAuth) signatureIsValid(req *http.Request) (ok bool, err error) { +func (m SignedURLAuthenticator) signatureIsValid(req *http.Request) (ok bool, err error) { u := revactx.ContextMustGetUser(req.Context()) signingKey, err := m.getSigningKey(req.Context(), u.Id.OpaqueId) if err != nil { - m.logger.Error().Err(err).Msg("could not retrieve signing key") + m.Logger.Error().Err(err).Msg("could not retrieve signing key") return false, err } if len(signingKey) == 0 { - m.logger.Error().Err(err).Msg("signing key empty") + m.Logger.Error().Err(err).Msg("signing key empty") return false, err } q := req.URL.Query() - signature := q.Get("OC-Signature") - q.Del("OC-Signature") + signature := q.Get(_paramOCSignature) + q.Del(_paramOCSignature) req.URL.RawQuery = q.Encode() url := req.URL.String() if !req.URL.IsAbs() { @@ -187,7 +161,7 @@ func (m signedURLAuth) signatureIsValid(req *http.Request) (ok bool, err error) return m.createSignature(url, signingKey) == signature, nil } -func (m signedURLAuth) createSignature(url string, signingKey []byte) string { +func (m SignedURLAuthenticator) createSignature(url string, signingKey []byte) string { // the oc10 signature check: $hash = \hash_pbkdf2("sha512", $url, $signingKey, 10000, 64, false); // - sets the length of the output string to 64 // - sets raw output to false -> if raw_output is FALSE length corresponds to twice the byte-length of the derived key (as every byte of the key is returned as two hexits). @@ -197,8 +171,8 @@ func (m signedURLAuth) createSignature(url string, signingKey []byte) string { return hex.EncodeToString(hash) } -func (m signedURLAuth) getSigningKey(ctx context.Context, ocisID string) ([]byte, error) { - res, err := m.store.Read(ctx, &storesvc.ReadRequest{ +func (m SignedURLAuthenticator) getSigningKey(ctx context.Context, ocisID string) ([]byte, error) { + res, err := m.Store.Read(ctx, &storesvc.ReadRequest{ Options: &storemsg.ReadOptions{ Database: "proxy", Table: "signing-keys", @@ -206,8 +180,44 @@ func (m signedURLAuth) getSigningKey(ctx context.Context, ocisID string) ([]byte Key: ocisID, }) if err != nil || len(res.Records) < 1 { - return []byte{}, err + return nil, err } return res.Records[0].Value, nil } + +// Authenticate implements the authenticator interface to authenticate requests via signed URL auth. +func (m SignedURLAuthenticator) Authenticate(r *http.Request) (*http.Request, bool) { + if !m.shouldServe(r) { + return nil, false + } + + user, _, err := m.UserProvider.GetUserByClaims(r.Context(), "username", r.URL.Query().Get(_paramOCCredential), true) + if err != nil { + m.Logger.Error(). + Err(err). + Str("authenticator", "signed_url"). + Str("path", r.URL.Path). + Msg("Could not get user by claim") + return nil, false + } + + ctx := revactx.ContextSetUser(r.Context(), user) + + r = r.WithContext(ctx) + + if err := m.validate(r); err != nil { + m.Logger.Error(). + Err(err). + Str("authenticator", "signed_url"). + Str("path", r.URL.Path). + Msg("Could not get user by claim") + return nil, false + } + + m.Logger.Debug(). + Str("authenticator", "signed_url"). + Str("path", r.URL.Path). + Msg("successfully authenticated request") + return r, true +} diff --git a/services/proxy/pkg/middleware/signed_url_auth_test.go b/services/proxy/pkg/middleware/signed_url_auth_test.go index 856fcdb0e2a..35f84e66559 100644 --- a/services/proxy/pkg/middleware/signed_url_auth_test.go +++ b/services/proxy/pkg/middleware/signed_url_auth_test.go @@ -7,7 +7,7 @@ import ( ) func TestSignedURLAuth_shouldServe(t *testing.T) { - pua := signedURLAuth{} + pua := SignedURLAuthenticator{} tests := []struct { url string enabled bool @@ -20,7 +20,7 @@ func TestSignedURLAuth_shouldServe(t *testing.T) { } for _, tt := range tests { - pua.preSignedURLConfig.Enabled = tt.enabled + pua.PreSignedURLConfig.Enabled = tt.enabled r := httptest.NewRequest("", tt.url, nil) result := pua.shouldServe(r) @@ -31,7 +31,7 @@ func TestSignedURLAuth_shouldServe(t *testing.T) { } func TestSignedURLAuth_allRequiredParametersPresent(t *testing.T) { - pua := signedURLAuth{} + pua := SignedURLAuthenticator{} baseURL := "https://example.com/example.jpg?" tests := []struct { params string @@ -54,7 +54,7 @@ func TestSignedURLAuth_allRequiredParametersPresent(t *testing.T) { } func TestSignedURLAuth_requestMethodMatches(t *testing.T) { - pua := signedURLAuth{} + pua := SignedURLAuthenticator{} tests := []struct { method string url string @@ -75,7 +75,7 @@ func TestSignedURLAuth_requestMethodMatches(t *testing.T) { } func TestSignedURLAuth_requestMethodIsAllowed(t *testing.T) { - pua := signedURLAuth{} + pua := SignedURLAuthenticator{} tests := []struct { method string allowed []string @@ -89,7 +89,7 @@ func TestSignedURLAuth_requestMethodIsAllowed(t *testing.T) { } for _, tt := range tests { - pua.preSignedURLConfig.AllowedHTTPMethods = tt.allowed + pua.PreSignedURLConfig.AllowedHTTPMethods = tt.allowed ok, _ := pua.requestMethodIsAllowed(tt.method) if ok != tt.expected { @@ -99,7 +99,7 @@ func TestSignedURLAuth_requestMethodIsAllowed(t *testing.T) { } func TestSignedURLAuth_urlIsExpired(t *testing.T) { - pua := signedURLAuth{} + pua := SignedURLAuthenticator{} nowFunc := func() time.Time { t, _ := time.Parse(time.RFC3339, "2020-02-02T12:30:00.000Z") return t @@ -126,7 +126,7 @@ func TestSignedURLAuth_urlIsExpired(t *testing.T) { } func TestSignedURLAuth_createSignature(t *testing.T) { - pua := signedURLAuth{} + pua := SignedURLAuthenticator{} expected := "27d2ebea381384af3179235114801dcd00f91e46f99fca72575301cf3948101d" s := pua.createSignature("something", []byte("somerandomkey")) diff --git a/services/search/pkg/command/server.go b/services/search/pkg/command/server.go index 7d181ca2718..88d3320fa94 100644 --- a/services/search/pkg/command/server.go +++ b/services/search/pkg/command/server.go @@ -3,9 +3,9 @@ package command import ( "context" "fmt" - "os" "github.com/oklog/run" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/ocis-pkg/version" "github.com/owncloud/ocis/v2/services/search/pkg/config" "github.com/owncloud/ocis/v2/services/search/pkg/config/parser" @@ -21,15 +21,10 @@ import ( func Server(cfg *config.Config) *cli.Command { return &cli.Command{ Name: "server", - Usage: fmt.Sprintf("start %s extension without runtime (unsupervised mode)", cfg.Service.Name), + Usage: fmt.Sprintf("start the %s service without runtime (unsupervised mode)", cfg.Service.Name), Category: "server", Before: func(c *cli.Context) error { - err := parser.ParseConfig(cfg) - if err != nil { - fmt.Printf("%v", err) - os.Exit(1) - } - return err + return configlog.ReturnFatal(parser.ParseConfig(cfg)) }, Action: func(c *cli.Context) error { logger := logging.Configure(cfg.Service.Name, cfg.Log) diff --git a/services/search/pkg/command/version.go b/services/search/pkg/command/version.go index 9aba6033b00..fd176dc9a7d 100644 --- a/services/search/pkg/command/version.go +++ b/services/search/pkg/command/version.go @@ -16,7 +16,7 @@ import ( func Version(cfg *config.Config) *cli.Command { return &cli.Command{ Name: "version", - Usage: "print the version of this binary and the running extension instances", + Usage: "print the version of this binary and the running service instances", Category: "info", Action: func(c *cli.Context) error { fmt.Println("Version: " + version.GetString()) diff --git a/services/settings/pkg/command/health.go b/services/settings/pkg/command/health.go index 68dee3672a7..59519140fd8 100644 --- a/services/settings/pkg/command/health.go +++ b/services/settings/pkg/command/health.go @@ -4,6 +4,7 @@ import ( "fmt" "net/http" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/services/settings/pkg/config" "github.com/owncloud/ocis/v2/services/settings/pkg/config/parser" "github.com/owncloud/ocis/v2/services/settings/pkg/logging" @@ -16,11 +17,7 @@ func Health(cfg *config.Config) *cli.Command { Name: "health", Usage: "Check health status", Before: func(c *cli.Context) error { - err := parser.ParseConfig(cfg) - if err != nil { - fmt.Printf("%v", err) - } - return err + return configlog.ReturnError(parser.ParseConfig(cfg)) }, Action: func(c *cli.Context) error { logger := logging.Configure(cfg.Service.Name, cfg.Log) diff --git a/services/settings/pkg/command/server.go b/services/settings/pkg/command/server.go index 9306b00bf9d..6e9571495ca 100644 --- a/services/settings/pkg/command/server.go +++ b/services/settings/pkg/command/server.go @@ -3,9 +3,9 @@ package command import ( "context" "fmt" - "os" "github.com/oklog/run" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/ocis-pkg/version" "github.com/owncloud/ocis/v2/services/settings/pkg/config" "github.com/owncloud/ocis/v2/services/settings/pkg/config/parser" @@ -22,15 +22,10 @@ import ( func Server(cfg *config.Config) *cli.Command { return &cli.Command{ Name: "server", - Usage: fmt.Sprintf("start %s extension without runtime (unsupervised mode)", cfg.Service.Name), + Usage: fmt.Sprintf("start the %s service without runtime (unsupervised mode)", cfg.Service.Name), Category: "server", Before: func(c *cli.Context) error { - err := parser.ParseConfig(cfg) - if err != nil { - fmt.Printf("%v", err) - os.Exit(1) - } - return err + return configlog.ReturnFatal(parser.ParseConfig(cfg)) }, Action: func(c *cli.Context) error { logger := logging.Configure(cfg.Service.Name, cfg.Log) diff --git a/services/settings/pkg/command/version.go b/services/settings/pkg/command/version.go index 9ac087f77d7..ac123be776c 100644 --- a/services/settings/pkg/command/version.go +++ b/services/settings/pkg/command/version.go @@ -16,7 +16,7 @@ import ( func Version(cfg *config.Config) *cli.Command { return &cli.Command{ Name: "version", - Usage: "print the version of this binary and the running extension instances", + Usage: "print the version of this binary and the running service instances", Category: "info", Action: func(c *cli.Context) error { fmt.Println("Version: " + version.GetString()) diff --git a/services/sharing/pkg/command/health.go b/services/sharing/pkg/command/health.go index 1c2bb37ed45..3e15bcd1cf3 100644 --- a/services/sharing/pkg/command/health.go +++ b/services/sharing/pkg/command/health.go @@ -4,6 +4,7 @@ import ( "fmt" "net/http" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/services/sharing/pkg/config" "github.com/owncloud/ocis/v2/services/sharing/pkg/config/parser" "github.com/owncloud/ocis/v2/services/sharing/pkg/logging" @@ -17,11 +18,7 @@ func Health(cfg *config.Config) *cli.Command { Usage: "check health status", Category: "info", Before: func(c *cli.Context) error { - err := parser.ParseConfig(cfg) - if err != nil { - fmt.Printf("%v", err) - } - return err + return configlog.ReturnError(parser.ParseConfig(cfg)) }, Action: func(c *cli.Context) error { logger := logging.Configure(cfg.Service.Name, cfg.Log) diff --git a/services/sharing/pkg/command/server.go b/services/sharing/pkg/command/server.go index a08cd092669..6154ff20b96 100644 --- a/services/sharing/pkg/command/server.go +++ b/services/sharing/pkg/command/server.go @@ -10,6 +10,7 @@ import ( "github.com/cs3org/reva/v2/cmd/revad/runtime" "github.com/gofrs/uuid" "github.com/oklog/run" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/ocis-pkg/service/external" "github.com/owncloud/ocis/v2/ocis-pkg/sync" "github.com/owncloud/ocis/v2/ocis-pkg/version" @@ -26,15 +27,10 @@ import ( func Server(cfg *config.Config) *cli.Command { return &cli.Command{ Name: "server", - Usage: fmt.Sprintf("start %s extension without runtime (unsupervised mode)", cfg.Service.Name), + Usage: fmt.Sprintf("start the %s service without runtime (unsupervised mode)", cfg.Service.Name), Category: "server", Before: func(c *cli.Context) error { - err := parser.ParseConfig(cfg) - if err != nil { - fmt.Printf("%v", err) - os.Exit(1) - } - return err + return configlog.ReturnFatal(parser.ParseConfig(cfg)) }, Action: func(c *cli.Context) error { logger := logging.Configure(cfg.Service.Name, cfg.Log) @@ -110,7 +106,7 @@ func Server(cfg *config.Config) *cli.Command { } } -// defineContext sets the context for the extension. If there is a context configured it will create a new child from it, +// defineContext sets the context for the service. If there is a context configured it will create a new child from it, // if not, it will create a root context that can be cancelled. func defineContext(cfg *config.Config) (context.Context, context.CancelFunc) { return func() (context.Context, context.CancelFunc) { diff --git a/services/sharing/pkg/command/version.go b/services/sharing/pkg/command/version.go index 368f0710d22..71582ede30b 100644 --- a/services/sharing/pkg/command/version.go +++ b/services/sharing/pkg/command/version.go @@ -16,7 +16,7 @@ import ( func Version(cfg *config.Config) *cli.Command { return &cli.Command{ Name: "version", - Usage: "print the version of this binary and the running extension instances", + Usage: "print the version of this binary and the running service instances", Category: "info", Action: func(c *cli.Context) error { fmt.Println("Version: " + version.GetString()) diff --git a/services/sharing/pkg/config/config.go b/services/sharing/pkg/config/config.go index bada48551bd..a9341bc7659 100644 --- a/services/sharing/pkg/config/config.go +++ b/services/sharing/pkg/config/config.go @@ -124,7 +124,7 @@ type PublicSharingSQLDriver struct { } type PublicSharingCS3Driver struct { - ProviderAddr string `yaml:"provider_addr" env:"SHARING_PUBLIC_CS3_PROVIDER_ADDR" desc:"GRPC address of the STORAGE-SYSTEM extension."` + ProviderAddr string `yaml:"provider_addr" env:"SHARING_PUBLIC_CS3_PROVIDER_ADDR" desc:"GRPC address of the STORAGE-SYSTEM service."` SystemUserID string `yaml:"system_user_id" env:"OCIS_SYSTEM_USER_ID;SHARING_PUBLIC_CS3_SYSTEM_USER_ID" desc:"ID of the oCIS STORAGE-SYSTEM system user. Admins need to set the ID for the STORAGE-SYSTEM system user in this config option which is then used to reference the user. Any reasonable long string is possible, preferably this would be an UUIDv4 format."` SystemUserIDP string `yaml:"system_user_idp" env:"OCIS_SYSTEM_USER_IDP;SHARING_PUBLIC_CS3_SYSTEM_USER_IDP" desc:"IDP of the oCIS STORAGE-SYSTEM system user."` SystemUserAPIKey string `yaml:"system_user_api_key" env:"OCIS_SYSTEM_USER_API_KEY;SHARING_USER_CS3_SYSTEM_USER_API_KEY" desc:"API key for the STORAGE-SYSTEM system user."` diff --git a/services/storage-publiclink/pkg/command/health.go b/services/storage-publiclink/pkg/command/health.go index b2f3889f507..f60117b4fa3 100644 --- a/services/storage-publiclink/pkg/command/health.go +++ b/services/storage-publiclink/pkg/command/health.go @@ -4,6 +4,7 @@ import ( "fmt" "net/http" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/services/storage-publiclink/pkg/config" "github.com/owncloud/ocis/v2/services/storage-publiclink/pkg/config/parser" "github.com/owncloud/ocis/v2/services/storage-publiclink/pkg/logging" @@ -17,11 +18,7 @@ func Health(cfg *config.Config) *cli.Command { Usage: "check health status", Category: "info", Before: func(c *cli.Context) error { - err := parser.ParseConfig(cfg) - if err != nil { - fmt.Printf("%v", err) - } - return err + return configlog.ReturnError(parser.ParseConfig(cfg)) }, Action: func(c *cli.Context) error { logger := logging.Configure(cfg.Service.Name, cfg.Log) diff --git a/services/storage-publiclink/pkg/command/server.go b/services/storage-publiclink/pkg/command/server.go index ece1c444d07..1c731ee52d7 100644 --- a/services/storage-publiclink/pkg/command/server.go +++ b/services/storage-publiclink/pkg/command/server.go @@ -9,6 +9,7 @@ import ( "github.com/cs3org/reva/v2/cmd/revad/runtime" "github.com/gofrs/uuid" "github.com/oklog/run" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/ocis-pkg/service/external" "github.com/owncloud/ocis/v2/ocis-pkg/sync" "github.com/owncloud/ocis/v2/ocis-pkg/version" @@ -25,15 +26,10 @@ import ( func Server(cfg *config.Config) *cli.Command { return &cli.Command{ Name: "server", - Usage: fmt.Sprintf("start %s extension without runtime (unsupervised mode)", cfg.Service.Name), + Usage: fmt.Sprintf("start the %s service without runtime (unsupervised mode)", cfg.Service.Name), Category: "server", Before: func(c *cli.Context) error { - err := parser.ParseConfig(cfg) - if err != nil { - fmt.Printf("%v", err) - os.Exit(1) - } - return err + return configlog.ReturnFatal(parser.ParseConfig(cfg)) }, Action: func(c *cli.Context) error { logger := logging.Configure(cfg.Service.Name, cfg.Log) @@ -97,7 +93,7 @@ func Server(cfg *config.Config) *cli.Command { } } -// defineContext sets the context for the extension. If there is a context configured it will create a new child from it, +// defineContext sets the context for the service. If there is a context configured it will create a new child from it, // if not, it will create a root context that can be cancelled. func defineContext(cfg *config.Config) (context.Context, context.CancelFunc) { return func() (context.Context, context.CancelFunc) { diff --git a/services/storage-publiclink/pkg/command/version.go b/services/storage-publiclink/pkg/command/version.go index 31e23c9f386..3a96eba8e99 100644 --- a/services/storage-publiclink/pkg/command/version.go +++ b/services/storage-publiclink/pkg/command/version.go @@ -16,7 +16,7 @@ import ( func Version(cfg *config.Config) *cli.Command { return &cli.Command{ Name: "version", - Usage: "print the version of this binary and the running extension instances", + Usage: "print the version of this binary and the running service instances", Category: "info", Action: func(c *cli.Context) error { fmt.Println("Version: " + version.GetString()) diff --git a/services/storage-shares/pkg/command/health.go b/services/storage-shares/pkg/command/health.go index 90e68c8ba17..4ed8a72cfad 100644 --- a/services/storage-shares/pkg/command/health.go +++ b/services/storage-shares/pkg/command/health.go @@ -4,6 +4,7 @@ import ( "fmt" "net/http" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/services/storage-shares/pkg/config" "github.com/owncloud/ocis/v2/services/storage-shares/pkg/config/parser" "github.com/owncloud/ocis/v2/services/storage-shares/pkg/logging" @@ -17,11 +18,7 @@ func Health(cfg *config.Config) *cli.Command { Usage: "check health status", Category: "info", Before: func(c *cli.Context) error { - err := parser.ParseConfig(cfg) - if err != nil { - fmt.Printf("%v", err) - } - return err + return configlog.ReturnError(parser.ParseConfig(cfg)) }, Action: func(c *cli.Context) error { logger := logging.Configure(cfg.Service.Name, cfg.Log) diff --git a/services/storage-shares/pkg/command/server.go b/services/storage-shares/pkg/command/server.go index 243baa43d74..d3e507e2bb5 100644 --- a/services/storage-shares/pkg/command/server.go +++ b/services/storage-shares/pkg/command/server.go @@ -9,6 +9,7 @@ import ( "github.com/cs3org/reva/v2/cmd/revad/runtime" "github.com/gofrs/uuid" "github.com/oklog/run" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/ocis-pkg/service/external" "github.com/owncloud/ocis/v2/ocis-pkg/sync" "github.com/owncloud/ocis/v2/ocis-pkg/version" @@ -25,15 +26,10 @@ import ( func Server(cfg *config.Config) *cli.Command { return &cli.Command{ Name: "server", - Usage: fmt.Sprintf("start %s extension without runtime (unsupervised mode)", cfg.Service.Name), + Usage: fmt.Sprintf("start the %s service without runtime (unsupervised mode)", cfg.Service.Name), Category: "server", Before: func(c *cli.Context) error { - err := parser.ParseConfig(cfg) - if err != nil { - fmt.Printf("%v", err) - os.Exit(1) - } - return err + return configlog.ReturnFatal(parser.ParseConfig(cfg)) }, Action: func(c *cli.Context) error { logger := logging.Configure(cfg.Service.Name, cfg.Log) @@ -97,7 +93,7 @@ func Server(cfg *config.Config) *cli.Command { } } -// defineContext sets the context for the extension. If there is a context configured it will create a new child from it, +// defineContext sets the context for the service. If there is a context configured it will create a new child from it, // if not, it will create a root context that can be cancelled. func defineContext(cfg *config.Config) (context.Context, context.CancelFunc) { return func() (context.Context, context.CancelFunc) { diff --git a/services/storage-shares/pkg/command/version.go b/services/storage-shares/pkg/command/version.go index df3e40b2fc6..e88d717d942 100644 --- a/services/storage-shares/pkg/command/version.go +++ b/services/storage-shares/pkg/command/version.go @@ -16,7 +16,7 @@ import ( func Version(cfg *config.Config) *cli.Command { return &cli.Command{ Name: "version", - Usage: "print the version of this binary and the running extension instances", + Usage: "print the version of this binary and the running service instances", Category: "info", Action: func(c *cli.Context) error { fmt.Println("Version: " + version.GetString()) diff --git a/services/storage-system/pkg/command/health.go b/services/storage-system/pkg/command/health.go index 8b5d5e116a9..c5e80577da1 100644 --- a/services/storage-system/pkg/command/health.go +++ b/services/storage-system/pkg/command/health.go @@ -4,6 +4,7 @@ import ( "fmt" "net/http" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/services/storage-system/pkg/config" "github.com/owncloud/ocis/v2/services/storage-system/pkg/config/parser" "github.com/owncloud/ocis/v2/services/storage-system/pkg/logging" @@ -17,11 +18,7 @@ func Health(cfg *config.Config) *cli.Command { Usage: "check health status", Category: "info", Before: func(c *cli.Context) error { - err := parser.ParseConfig(cfg) - if err != nil { - fmt.Printf("%v", err) - } - return err + return configlog.ReturnError(parser.ParseConfig(cfg)) }, Action: func(c *cli.Context) error { logger := logging.Configure(cfg.Service.Name, cfg.Log) diff --git a/services/storage-system/pkg/command/server.go b/services/storage-system/pkg/command/server.go index 1e5aecd39f4..de6095a66da 100644 --- a/services/storage-system/pkg/command/server.go +++ b/services/storage-system/pkg/command/server.go @@ -9,6 +9,7 @@ import ( "github.com/cs3org/reva/v2/cmd/revad/runtime" "github.com/gofrs/uuid" "github.com/oklog/run" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/ocis-pkg/service/external" "github.com/owncloud/ocis/v2/ocis-pkg/sync" "github.com/owncloud/ocis/v2/ocis-pkg/version" @@ -25,15 +26,10 @@ import ( func Server(cfg *config.Config) *cli.Command { return &cli.Command{ Name: "server", - Usage: fmt.Sprintf("start %s extension without runtime (unsupervised mode)", cfg.Service.Name), + Usage: fmt.Sprintf("start the %s service without runtime (unsupervised mode)", cfg.Service.Name), Category: "server", Before: func(c *cli.Context) error { - err := parser.ParseConfig(cfg) - if err != nil { - fmt.Printf("%v", err) - os.Exit(1) - } - return err + return configlog.ReturnFatal(parser.ParseConfig(cfg)) }, Action: func(c *cli.Context) error { logger := logging.Configure(cfg.Service.Name, cfg.Log) @@ -108,7 +104,7 @@ func Server(cfg *config.Config) *cli.Command { } } -// defineContext sets the context for the extension. If there is a context configured it will create a new child from it, +// defineContext sets the context for the service. If there is a context configured it will create a new child from it, // if not, it will create a root context that can be cancelled. func defineContext(cfg *config.Config) (context.Context, context.CancelFunc) { return func() (context.Context, context.CancelFunc) { diff --git a/services/storage-system/pkg/command/version.go b/services/storage-system/pkg/command/version.go index 43898d14907..d1c3b7170a6 100644 --- a/services/storage-system/pkg/command/version.go +++ b/services/storage-system/pkg/command/version.go @@ -16,7 +16,7 @@ import ( func Version(cfg *config.Config) *cli.Command { return &cli.Command{ Name: "version", - Usage: "print the version of this binary and the running extension instances", + Usage: "print the version of this binary and the running service instances", Category: "info", Action: func(c *cli.Context) error { fmt.Println("Version: " + version.GetString()) diff --git a/services/storage-users/pkg/command/health.go b/services/storage-users/pkg/command/health.go index 9dcb45556a8..717df82eb4a 100644 --- a/services/storage-users/pkg/command/health.go +++ b/services/storage-users/pkg/command/health.go @@ -4,6 +4,7 @@ import ( "fmt" "net/http" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/services/storage-users/pkg/config" "github.com/owncloud/ocis/v2/services/storage-users/pkg/config/parser" "github.com/owncloud/ocis/v2/services/storage-users/pkg/logging" @@ -17,11 +18,7 @@ func Health(cfg *config.Config) *cli.Command { Usage: "check health status", Category: "info", Before: func(c *cli.Context) error { - err := parser.ParseConfig(cfg) - if err != nil { - fmt.Printf("%v", err) - } - return err + return configlog.ReturnError(parser.ParseConfig(cfg)) }, Action: func(c *cli.Context) error { logger := logging.Configure(cfg.Service.Name, cfg.Log) diff --git a/services/storage-users/pkg/command/server.go b/services/storage-users/pkg/command/server.go index 1b93469990b..8c976eb376b 100644 --- a/services/storage-users/pkg/command/server.go +++ b/services/storage-users/pkg/command/server.go @@ -9,6 +9,7 @@ import ( "github.com/cs3org/reva/v2/cmd/revad/runtime" "github.com/gofrs/uuid" "github.com/oklog/run" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/ocis-pkg/service/external" "github.com/owncloud/ocis/v2/ocis-pkg/sync" "github.com/owncloud/ocis/v2/ocis-pkg/version" @@ -25,15 +26,10 @@ import ( func Server(cfg *config.Config) *cli.Command { return &cli.Command{ Name: "server", - Usage: fmt.Sprintf("start %s extension without runtime (unsupervised mode)", cfg.Service.Name), + Usage: fmt.Sprintf("start the %s service without runtime (unsupervised mode)", cfg.Service.Name), Category: "server", Before: func(c *cli.Context) error { - err := parser.ParseConfig(cfg) - if err != nil { - fmt.Printf("%v", err) - os.Exit(1) - } - return err + return configlog.ReturnFatal(parser.ParseConfig(cfg)) }, Action: func(c *cli.Context) error { logger := logging.Configure(cfg.Service.Name, cfg.Log) @@ -97,7 +93,7 @@ func Server(cfg *config.Config) *cli.Command { } } -// defineContext sets the context for the extension. If there is a context configured it will create a new child from it, +// defineContext sets the context for the service. If there is a context configured it will create a new child from it, // if not, it will create a root context that can be cancelled. func defineContext(cfg *config.Config) (context.Context, context.CancelFunc) { return func() (context.Context, context.CancelFunc) { diff --git a/services/storage-users/pkg/command/uploads.go b/services/storage-users/pkg/command/uploads.go index ea553de0137..506dee2dab8 100644 --- a/services/storage-users/pkg/command/uploads.go +++ b/services/storage-users/pkg/command/uploads.go @@ -12,6 +12,7 @@ import ( "github.com/cs3org/reva/v2/pkg/storage" "github.com/cs3org/reva/v2/pkg/storage/fs/registry" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/services/storage-users/pkg/config" "github.com/owncloud/ocis/v2/services/storage-users/pkg/config/parser" "github.com/owncloud/ocis/v2/services/storage-users/pkg/revaconfig" @@ -19,16 +20,9 @@ import ( func Uploads(cfg *config.Config) *cli.Command { return &cli.Command{ - Name: "uploads", - Usage: "manage unfinished uploads", - Category: "maintenance", - Before: func(c *cli.Context) error { - if err := parser.ParseConfig(cfg); err != nil { - fmt.Printf("%v", err) - return err - } - return nil - }, + + Name: "uploads", + Usage: "manage unfinished uploads", Subcommands: []*cli.Command{ ListUploads(cfg), PurgeExpiredUploads(cfg), @@ -42,12 +36,7 @@ func ListUploads(cfg *config.Config) *cli.Command { Name: "list", Usage: "Print a list of all incomplete uploads", Before: func(c *cli.Context) error { - err := parser.ParseConfig(cfg) - if err != nil { - fmt.Printf("%v", err) - os.Exit(1) - } - return err + return configlog.ReturnFatal(parser.ParseConfig(cfg)) }, Action: func(c *cli.Context) error { f, ok := registry.NewFuncs[cfg.Driver] @@ -88,12 +77,7 @@ func PurgeExpiredUploads(cfg *config.Config) *cli.Command { Name: "clean", Usage: "Clean up leftovers from expired uploads", Before: func(c *cli.Context) error { - err := parser.ParseConfig(cfg) - if err != nil { - fmt.Printf("%v", err) - os.Exit(1) - } - return err + return configlog.ReturnFatal(parser.ParseConfig(cfg)) }, Action: func(c *cli.Context) error { f, ok := registry.NewFuncs[cfg.Driver] diff --git a/services/storage-users/pkg/command/version.go b/services/storage-users/pkg/command/version.go index 153d72e5516..b305b0d6151 100644 --- a/services/storage-users/pkg/command/version.go +++ b/services/storage-users/pkg/command/version.go @@ -16,7 +16,7 @@ import ( func Version(cfg *config.Config) *cli.Command { return &cli.Command{ Name: "version", - Usage: "print the version of this binary and the running extension instances", + Usage: "print the version of this binary and the running service instances", Category: "info", Action: func(c *cli.Context) error { fmt.Println("Version: " + version.GetString()) diff --git a/services/store/pkg/command/health.go b/services/store/pkg/command/health.go index e08ec2c782a..6d2abc564f8 100644 --- a/services/store/pkg/command/health.go +++ b/services/store/pkg/command/health.go @@ -4,6 +4,7 @@ import ( "fmt" "net/http" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/services/store/pkg/config" "github.com/owncloud/ocis/v2/services/store/pkg/config/parser" "github.com/owncloud/ocis/v2/services/store/pkg/logging" @@ -17,11 +18,7 @@ func Health(cfg *config.Config) *cli.Command { Usage: "check health status", Category: "info", Before: func(c *cli.Context) error { - err := parser.ParseConfig(cfg) - if err != nil { - fmt.Printf("%v", err) - } - return err + return configlog.ReturnError(parser.ParseConfig(cfg)) }, Action: func(c *cli.Context) error { logger := logging.Configure(cfg.Service.Name, cfg.Log) diff --git a/services/store/pkg/command/server.go b/services/store/pkg/command/server.go index ceb0d0c84ef..76534809bb3 100644 --- a/services/store/pkg/command/server.go +++ b/services/store/pkg/command/server.go @@ -3,10 +3,10 @@ package command import ( "context" "fmt" - "os" "github.com/oklog/run" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/ocis-pkg/version" "github.com/owncloud/ocis/v2/services/store/pkg/config" "github.com/owncloud/ocis/v2/services/store/pkg/config/parser" @@ -22,15 +22,10 @@ import ( func Server(cfg *config.Config) *cli.Command { return &cli.Command{ Name: "server", - Usage: fmt.Sprintf("start %s extension without runtime (unsupervised mode)", cfg.Service.Name), + Usage: fmt.Sprintf("start the %s service without runtime (unsupervised mode)", cfg.Service.Name), Category: "server", Before: func(c *cli.Context) error { - err := parser.ParseConfig(cfg) - if err != nil { - fmt.Printf("%v", err) - os.Exit(1) - } - return err + return configlog.ReturnFatal(parser.ParseConfig(cfg)) }, Action: func(c *cli.Context) error { logger := logging.Configure(cfg.Service.Name, cfg.Log) diff --git a/services/store/pkg/command/version.go b/services/store/pkg/command/version.go index b1cfe574299..81fcb3533ab 100644 --- a/services/store/pkg/command/version.go +++ b/services/store/pkg/command/version.go @@ -16,7 +16,7 @@ import ( func Version(cfg *config.Config) *cli.Command { return &cli.Command{ Name: "version", - Usage: "print the version of this binary and the running extension instances", + Usage: "print the version of this binary and the running service instances", Category: "info", Action: func(c *cli.Context) error { fmt.Println("Version: " + version.GetString()) diff --git a/services/thumbnails/pkg/command/health.go b/services/thumbnails/pkg/command/health.go index d8e1210b01c..a730037c366 100644 --- a/services/thumbnails/pkg/command/health.go +++ b/services/thumbnails/pkg/command/health.go @@ -4,6 +4,7 @@ import ( "fmt" "net/http" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/services/thumbnails/pkg/config" "github.com/owncloud/ocis/v2/services/thumbnails/pkg/config/parser" "github.com/owncloud/ocis/v2/services/thumbnails/pkg/logging" @@ -17,11 +18,7 @@ func Health(cfg *config.Config) *cli.Command { Usage: "check health status", Category: "info", Before: func(c *cli.Context) error { - err := parser.ParseConfig(cfg) - if err != nil { - fmt.Printf("%v", err) - } - return err + return configlog.ReturnError(parser.ParseConfig(cfg)) }, Action: func(c *cli.Context) error { logger := logging.Configure(cfg.Service.Name, cfg.Log) diff --git a/services/thumbnails/pkg/command/server.go b/services/thumbnails/pkg/command/server.go index a6cfd16e68c..c79b882ddcb 100644 --- a/services/thumbnails/pkg/command/server.go +++ b/services/thumbnails/pkg/command/server.go @@ -3,9 +3,9 @@ package command import ( "context" "fmt" - "os" "github.com/oklog/run" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/ocis-pkg/version" "github.com/owncloud/ocis/v2/services/thumbnails/pkg/config" "github.com/owncloud/ocis/v2/services/thumbnails/pkg/config/parser" @@ -22,15 +22,10 @@ import ( func Server(cfg *config.Config) *cli.Command { return &cli.Command{ Name: "server", - Usage: fmt.Sprintf("start %s extension without runtime (unsupervised mode)", cfg.Service.Name), + Usage: fmt.Sprintf("start the %s service without runtime (unsupervised mode)", cfg.Service.Name), Category: "server", Before: func(c *cli.Context) error { - err := parser.ParseConfig(cfg) - if err != nil { - fmt.Printf("%v", err) - os.Exit(1) - } - return err + return configlog.ReturnFatal(parser.ParseConfig(cfg)) }, Action: func(c *cli.Context) error { logger := logging.Configure(cfg.Service.Name, cfg.Log) diff --git a/services/thumbnails/pkg/command/version.go b/services/thumbnails/pkg/command/version.go index 5b893a8979e..b52381f04aa 100644 --- a/services/thumbnails/pkg/command/version.go +++ b/services/thumbnails/pkg/command/version.go @@ -16,7 +16,7 @@ import ( func Version(cfg *config.Config) *cli.Command { return &cli.Command{ Name: "version", - Usage: "print the version of this binary and the running extension instances", + Usage: "print the version of this binary and the running service instances", Category: "info", Action: func(c *cli.Context) error { fmt.Println("Version: " + version.GetString()) diff --git a/services/thumbnails/pkg/service/http/v0/service.go b/services/thumbnails/pkg/service/http/v0/service.go index a124ab7e631..8b201658c4c 100644 --- a/services/thumbnails/pkg/service/http/v0/service.go +++ b/services/thumbnails/pkg/service/http/v0/service.go @@ -21,7 +21,7 @@ const ( keyContextKey contextKey = "key" ) -// Service defines the extension handlers. +// Service defines the service handlers. type Service interface { ServeHTTP(http.ResponseWriter, *http.Request) GetThumbnail(http.ResponseWriter, *http.Request) diff --git a/services/users/pkg/command/health.go b/services/users/pkg/command/health.go index 729dcf4d095..7884cdc4137 100644 --- a/services/users/pkg/command/health.go +++ b/services/users/pkg/command/health.go @@ -4,6 +4,7 @@ import ( "fmt" "net/http" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/services/users/pkg/config" "github.com/owncloud/ocis/v2/services/users/pkg/config/parser" "github.com/owncloud/ocis/v2/services/users/pkg/logging" @@ -17,11 +18,7 @@ func Health(cfg *config.Config) *cli.Command { Usage: "check health status", Category: "info", Before: func(c *cli.Context) error { - err := parser.ParseConfig(cfg) - if err != nil { - fmt.Printf("%v", err) - } - return err + return configlog.ReturnError(parser.ParseConfig(cfg)) }, Action: func(c *cli.Context) error { logger := logging.Configure(cfg.Service.Name, cfg.Log) diff --git a/services/users/pkg/command/server.go b/services/users/pkg/command/server.go index 81d849d879e..b0419b305a0 100644 --- a/services/users/pkg/command/server.go +++ b/services/users/pkg/command/server.go @@ -9,6 +9,7 @@ import ( "github.com/cs3org/reva/v2/cmd/revad/runtime" "github.com/gofrs/uuid" "github.com/oklog/run" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/ocis-pkg/ldap" "github.com/owncloud/ocis/v2/ocis-pkg/service/external" "github.com/owncloud/ocis/v2/ocis-pkg/sync" @@ -26,15 +27,10 @@ import ( func Server(cfg *config.Config) *cli.Command { return &cli.Command{ Name: "server", - Usage: fmt.Sprintf("start %s extension without runtime (unsupervised mode)", cfg.Service.Name), + Usage: fmt.Sprintf("start the %s service without runtime (unsupervised mode)", cfg.Service.Name), Category: "server", Before: func(c *cli.Context) error { - err := parser.ParseConfig(cfg) - if err != nil { - fmt.Printf("%v", err) - os.Exit(1) - } - return err + return configlog.ReturnFatal(parser.ParseConfig(cfg)) }, Action: func(c *cli.Context) error { logger := logging.Configure(cfg.Service.Name, cfg.Log) @@ -110,7 +106,7 @@ func Server(cfg *config.Config) *cli.Command { } } -// defineContext sets the context for the extension. If there is a context configured it will create a new child from it, +// defineContext sets the context for the service. If there is a context configured it will create a new child from it, // if not, it will create a root context that can be cancelled. func defineContext(cfg *config.Config) (context.Context, context.CancelFunc) { return func() (context.Context, context.CancelFunc) { diff --git a/services/users/pkg/command/version.go b/services/users/pkg/command/version.go index d4f8c4038aa..7fd54b70ae1 100644 --- a/services/users/pkg/command/version.go +++ b/services/users/pkg/command/version.go @@ -16,7 +16,7 @@ import ( func Version(cfg *config.Config) *cli.Command { return &cli.Command{ Name: "version", - Usage: "print the version of this binary and the running extension instances", + Usage: "print the version of this binary and the running service instances", Category: "info", Action: func(c *cli.Context) error { fmt.Println("Version: " + version.GetString()) diff --git a/services/web/Makefile b/services/web/Makefile index 662c784822e..331ef4ab296 100644 --- a/services/web/Makefile +++ b/services/web/Makefile @@ -1,6 +1,6 @@ SHELL := bash NAME := web -WEB_ASSETS_VERSION = v5.7.0-rc.9 +WEB_ASSETS_VERSION = v5.7.0-rc.10 include ../../.make/recursion.mk diff --git a/services/web/pkg/command/health.go b/services/web/pkg/command/health.go index 633067f8567..db6a6924084 100644 --- a/services/web/pkg/command/health.go +++ b/services/web/pkg/command/health.go @@ -4,6 +4,7 @@ import ( "fmt" "net/http" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/services/web/pkg/config" "github.com/owncloud/ocis/v2/services/web/pkg/config/parser" "github.com/owncloud/ocis/v2/services/web/pkg/logging" @@ -17,11 +18,7 @@ func Health(cfg *config.Config) *cli.Command { Usage: "check health status", Category: "info", Before: func(c *cli.Context) error { - err := parser.ParseConfig(cfg) - if err != nil { - fmt.Printf("%v", err) - } - return err + return configlog.ReturnError(parser.ParseConfig(cfg)) }, Action: func(c *cli.Context) error { logger := logging.Configure(cfg.Service.Name, cfg.Log) diff --git a/services/web/pkg/command/server.go b/services/web/pkg/command/server.go index 2a90ff4e8ae..3c430369db8 100644 --- a/services/web/pkg/command/server.go +++ b/services/web/pkg/command/server.go @@ -5,9 +5,9 @@ import ( "encoding/json" "fmt" "io/ioutil" - "os" "github.com/oklog/run" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/services/web/pkg/config" "github.com/owncloud/ocis/v2/services/web/pkg/config/parser" "github.com/owncloud/ocis/v2/services/web/pkg/logging" @@ -22,15 +22,10 @@ import ( func Server(cfg *config.Config) *cli.Command { return &cli.Command{ Name: "server", - Usage: fmt.Sprintf("start %s extension without runtime (unsupervised mode)", cfg.Service.Name), + Usage: fmt.Sprintf("start the %s service without runtime (unsupervised mode)", cfg.Service.Name), Category: "server", Before: func(c *cli.Context) error { - err := parser.ParseConfig(cfg) - if err != nil { - fmt.Printf("%v", err) - os.Exit(1) - } - return err + return configlog.ReturnFatal(parser.ParseConfig(cfg)) }, Action: func(c *cli.Context) error { logger := logging.Configure(cfg.Service.Name, cfg.Log) diff --git a/services/web/pkg/command/version.go b/services/web/pkg/command/version.go index faef4e15bc9..6b1111fca18 100644 --- a/services/web/pkg/command/version.go +++ b/services/web/pkg/command/version.go @@ -16,7 +16,7 @@ import ( func Version(cfg *config.Config) *cli.Command { return &cli.Command{ Name: "version", - Usage: "print the version of this binary and the running extension instances", + Usage: "print the version of this binary and the running service instances", Category: "info", Action: func(c *cli.Context) error { fmt.Println("Version: " + version.GetString()) diff --git a/services/web/pkg/service/v0/service.go b/services/web/pkg/service/v0/service.go index 342c39e2546..a99c4c2930b 100644 --- a/services/web/pkg/service/v0/service.go +++ b/services/web/pkg/service/v0/service.go @@ -22,7 +22,7 @@ var ( ErrConfigInvalid = `Invalid or missing config` ) -// Service defines the extension handlers. +// Service defines the service handlers. type Service interface { ServeHTTP(http.ResponseWriter, *http.Request) Config(http.ResponseWriter, *http.Request) diff --git a/services/webdav/pkg/command/health.go b/services/webdav/pkg/command/health.go index e0bc1d5d28d..f7c16c6c552 100644 --- a/services/webdav/pkg/command/health.go +++ b/services/webdav/pkg/command/health.go @@ -4,6 +4,7 @@ import ( "fmt" "net/http" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/services/webdav/pkg/config" "github.com/owncloud/ocis/v2/services/webdav/pkg/config/parser" "github.com/owncloud/ocis/v2/services/webdav/pkg/logging" @@ -17,11 +18,7 @@ func Health(cfg *config.Config) *cli.Command { Usage: "check health status", Category: "info", Before: func(c *cli.Context) error { - err := parser.ParseConfig(cfg) - if err != nil { - fmt.Printf("%v", err) - } - return err + return configlog.ReturnError(parser.ParseConfig(cfg)) }, Action: func(c *cli.Context) error { logger := logging.Configure(cfg.Service.Name, cfg.Log) diff --git a/services/webdav/pkg/command/server.go b/services/webdav/pkg/command/server.go index 43f1744e0d8..5393a453f9a 100644 --- a/services/webdav/pkg/command/server.go +++ b/services/webdav/pkg/command/server.go @@ -3,9 +3,9 @@ package command import ( "context" "fmt" - "os" "github.com/oklog/run" + "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/ocis-pkg/version" "github.com/owncloud/ocis/v2/services/webdav/pkg/config" "github.com/owncloud/ocis/v2/services/webdav/pkg/config/parser" @@ -21,15 +21,10 @@ import ( func Server(cfg *config.Config) *cli.Command { return &cli.Command{ Name: "server", - Usage: fmt.Sprintf("start %s extension without runtime (unsupervised mode)", cfg.Service.Name), + Usage: fmt.Sprintf("start the %s service without runtime (unsupervised mode)", cfg.Service.Name), Category: "server", Before: func(c *cli.Context) error { - err := parser.ParseConfig(cfg) - if err != nil { - fmt.Printf("%v", err) - os.Exit(1) - } - return err + return configlog.ReturnFatal(parser.ParseConfig(cfg)) }, Action: func(c *cli.Context) error { logger := logging.Configure(cfg.Service.Name, cfg.Log) diff --git a/services/webdav/pkg/command/version.go b/services/webdav/pkg/command/version.go index fed75e7920e..b70abaaf7d5 100644 --- a/services/webdav/pkg/command/version.go +++ b/services/webdav/pkg/command/version.go @@ -16,7 +16,7 @@ import ( func Version(cfg *config.Config) *cli.Command { return &cli.Command{ Name: "version", - Usage: "print the version of this binary and the running extension instances", + Usage: "print the version of this binary and the running service instances", Category: "info", Action: func(c *cli.Context) error { fmt.Println("Version: " + version.GetString()) diff --git a/tests/acceptance/expected-failures-API-on-OCIS-storage.md b/tests/acceptance/expected-failures-API-on-OCIS-storage.md index 7da96c76e19..c1e25a26f38 100644 --- a/tests/acceptance/expected-failures-API-on-OCIS-storage.md +++ b/tests/acceptance/expected-failures-API-on-OCIS-storage.md @@ -195,22 +195,22 @@ Synchronization features like etag propagation, setting mtime and locking files - [apiWebdavLocks2/resharedSharesToShares.feature:32](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/resharedSharesToShares.feature#L32) - [apiWebdavLocks2/resharedSharesToShares.feature:33](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/resharedSharesToShares.feature#L33) - [apiWebdavLocks2/resharedSharesToShares.feature:34](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/resharedSharesToShares.feature#L34) -- [apiWebdavLocks2/resharedSharesToShares.feature:61](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/resharedSharesToShares.feature#L61) -- [apiWebdavLocks2/resharedSharesToShares.feature:62](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/resharedSharesToShares.feature#L62) -- [apiWebdavLocks2/resharedSharesToShares.feature:63](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/resharedSharesToShares.feature#L63) -- [apiWebdavLocks2/resharedSharesToShares.feature:64](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/resharedSharesToShares.feature#L64) -- [apiWebdavLocks2/resharedSharesToShares.feature:87](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/resharedSharesToShares.feature#L87) -- [apiWebdavLocks2/resharedSharesToShares.feature:88](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/resharedSharesToShares.feature#L88) -- [apiWebdavLocks2/resharedSharesToShares.feature:89](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/resharedSharesToShares.feature#L89) -- [apiWebdavLocks2/resharedSharesToShares.feature:90](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/resharedSharesToShares.feature#L90) -- [apiWebdavLocks2/resharedSharesToShares.feature:109](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/resharedSharesToShares.feature#L109) -- [apiWebdavLocks2/resharedSharesToShares.feature:110](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/resharedSharesToShares.feature#L110) -- [apiWebdavLocks2/resharedSharesToShares.feature:111](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/resharedSharesToShares.feature#L111) -- [apiWebdavLocks2/resharedSharesToShares.feature:112](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/resharedSharesToShares.feature#L112) -- [apiWebdavLocks2/resharedSharesToShares.feature:136](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/resharedSharesToShares.feature#L136) -- [apiWebdavLocks2/resharedSharesToShares.feature:137](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/resharedSharesToShares.feature#L137) -- [apiWebdavLocks2/resharedSharesToShares.feature:138](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/resharedSharesToShares.feature#L138) -- [apiWebdavLocks2/resharedSharesToShares.feature:139](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/resharedSharesToShares.feature#L139) +- [apiWebdavLocks2/resharedSharesToShares.feature:55](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/resharedSharesToShares.feature#L55) +- [apiWebdavLocks2/resharedSharesToShares.feature:56](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/resharedSharesToShares.feature#L56) +- [apiWebdavLocks2/resharedSharesToShares.feature:57](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/resharedSharesToShares.feature#L57) +- [apiWebdavLocks2/resharedSharesToShares.feature:58](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/resharedSharesToShares.feature#L58) +- [apiWebdavLocks2/resharedSharesToShares.feature:75](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/resharedSharesToShares.feature#L75) +- [apiWebdavLocks2/resharedSharesToShares.feature:76](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/resharedSharesToShares.feature#L76) +- [apiWebdavLocks2/resharedSharesToShares.feature:77](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/resharedSharesToShares.feature#L77) +- [apiWebdavLocks2/resharedSharesToShares.feature:78](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/resharedSharesToShares.feature#L78) +- [apiWebdavLocks2/resharedSharesToShares.feature:97](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/resharedSharesToShares.feature#L97) +- [apiWebdavLocks2/resharedSharesToShares.feature:98](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/resharedSharesToShares.feature#L98) +- [apiWebdavLocks2/resharedSharesToShares.feature:99](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/resharedSharesToShares.feature#L99) +- [apiWebdavLocks2/resharedSharesToShares.feature:100](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/resharedSharesToShares.feature#L100) +- [apiWebdavLocks2/resharedSharesToShares.feature:118](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/resharedSharesToShares.feature#L118) +- [apiWebdavLocks2/resharedSharesToShares.feature:119](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/resharedSharesToShares.feature#L119) +- [apiWebdavLocks2/resharedSharesToShares.feature:120](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/resharedSharesToShares.feature#L120) +- [apiWebdavLocks2/resharedSharesToShares.feature:121](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/resharedSharesToShares.feature#L121) - [apiWebdavLocks2/setTimeout.feature:24](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/setTimeout.feature#L24) - [apiWebdavLocks2/setTimeout.feature:25](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/setTimeout.feature#L25) - [apiWebdavLocks2/setTimeout.feature:26](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/setTimeout.feature#L26) @@ -270,16 +270,16 @@ Synchronization features like etag propagation, setting mtime and locking files - [apiWebdavLocks2/setTimeoutSharesToShares.feature:39](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/setTimeoutSharesToShares.feature#L39) - [apiWebdavLocks2/setTimeoutSharesToShares.feature:40](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/setTimeoutSharesToShares.feature#L40) - [apiWebdavLocks2/setTimeoutSharesToShares.feature:41](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/setTimeoutSharesToShares.feature#L41) +- [apiWebdavLocks2/setTimeoutSharesToShares.feature:57](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/setTimeoutSharesToShares.feature#L57) +- [apiWebdavLocks2/setTimeoutSharesToShares.feature:58](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/setTimeoutSharesToShares.feature#L58) +- [apiWebdavLocks2/setTimeoutSharesToShares.feature:59](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/setTimeoutSharesToShares.feature#L59) +- [apiWebdavLocks2/setTimeoutSharesToShares.feature:60](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/setTimeoutSharesToShares.feature#L60) +- [apiWebdavLocks2/setTimeoutSharesToShares.feature:61](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/setTimeoutSharesToShares.feature#L61) +- [apiWebdavLocks2/setTimeoutSharesToShares.feature:62](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/setTimeoutSharesToShares.feature#L62) +- [apiWebdavLocks2/setTimeoutSharesToShares.feature:63](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/setTimeoutSharesToShares.feature#L63) +- [apiWebdavLocks2/setTimeoutSharesToShares.feature:64](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/setTimeoutSharesToShares.feature#L64) +- [apiWebdavLocks2/setTimeoutSharesToShares.feature:65](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/setTimeoutSharesToShares.feature#L65) - [apiWebdavLocks2/setTimeoutSharesToShares.feature:66](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/setTimeoutSharesToShares.feature#L66) -- [apiWebdavLocks2/setTimeoutSharesToShares.feature:67](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/setTimeoutSharesToShares.feature#L67) -- [apiWebdavLocks2/setTimeoutSharesToShares.feature:68](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/setTimeoutSharesToShares.feature#L68) -- [apiWebdavLocks2/setTimeoutSharesToShares.feature:69](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/setTimeoutSharesToShares.feature#L69) -- [apiWebdavLocks2/setTimeoutSharesToShares.feature:70](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/setTimeoutSharesToShares.feature#L70) -- [apiWebdavLocks2/setTimeoutSharesToShares.feature:71](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/setTimeoutSharesToShares.feature#L71) -- [apiWebdavLocks2/setTimeoutSharesToShares.feature:72](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/setTimeoutSharesToShares.feature#L72) -- [apiWebdavLocks2/setTimeoutSharesToShares.feature:73](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/setTimeoutSharesToShares.feature#L73) -- [apiWebdavLocks2/setTimeoutSharesToShares.feature:74](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/setTimeoutSharesToShares.feature#L74) -- [apiWebdavLocks2/setTimeoutSharesToShares.feature:75](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/setTimeoutSharesToShares.feature#L75) - [apiWebdavLocks3/independentLocks.feature:25](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks3/independentLocks.feature#L25) - [apiWebdavLocks3/independentLocks.feature:26](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks3/independentLocks.feature#L26) - [apiWebdavLocks3/independentLocks.feature:27](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks3/independentLocks.feature#L27) @@ -447,10 +447,6 @@ File and sync features in a shared scenario - [apiShareManagementToShares/mergeShare.feature:105](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareManagementToShares/mergeShare.feature#L105) -#### [not possible to move file into a received folder](https://github.com/owncloud/ocis/issues/764) - -- [apiShareManagementBasicToShares/createShareToSharesFolder.feature:500](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareManagementBasicToShares/createShareToSharesFolder.feature#L500) - #### [File deletion using dav gives unique string in filename in the trashbin](https://github.com/owncloud/product/issues/178) - [apiShareManagementBasicToShares/deleteShareFromShares.feature:67](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareManagementBasicToShares/deleteShareFromShares.feature#L67) @@ -588,13 +584,11 @@ cannot share a folder with create permission - [apiShareOperationsToShares1/changingFilesShare.feature:25](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareOperationsToShares1/changingFilesShare.feature#L25) - [apiShareOperationsToShares1/changingFilesShare.feature:26](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareOperationsToShares1/changingFilesShare.feature#L26) -- [apiShareOperationsToShares1/changingFilesShare.feature:31](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareOperationsToShares1/changingFilesShare.feature#L31) -- [apiShareOperationsToShares1/changingFilesShare.feature:119](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareOperationsToShares1/changingFilesShare.feature#L119) -- [apiShareOperationsToShares1/changingFilesShare.feature:120](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareOperationsToShares1/changingFilesShare.feature#L120) -- [apiShareOperationsToShares1/changingFilesShare.feature:125](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareOperationsToShares1/changingFilesShare.feature#L125) -- [apiShareOperationsToShares1/changingFilesShare.feature:146](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareOperationsToShares1/changingFilesShare.feature#L146) -- [apiShareOperationsToShares1/changingFilesShare.feature:147](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareOperationsToShares1/changingFilesShare.feature#L147) -- [apiShareOperationsToShares1/changingFilesShare.feature:152](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareOperationsToShares1/changingFilesShare.feature#L152) +- [apiShareOperationsToShares1/changingFilesShare.feature:110](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareOperationsToShares1/changingFilesShare.feature#L110) +- [apiShareOperationsToShares1/changingFilesShare.feature:111](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareOperationsToShares1/changingFilesShare.feature#L111) +- [apiShareOperationsToShares1/changingFilesShare.feature:131](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareOperationsToShares1/changingFilesShare.feature#L131) +- [apiShareOperationsToShares1/changingFilesShare.feature:132](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareOperationsToShares1/changingFilesShare.feature#L132) +- [apiShareManagementBasicToShares/createShareToSharesFolder.feature:500](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareManagementBasicToShares/createShareToSharesFolder.feature#L500) - [apiVersions/fileVersionsSharingToShares.feature:220](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiVersions/fileVersionsSharingToShares.feature#L220) - [apiVersions/fileVersionsSharingToShares.feature:221](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiVersions/fileVersionsSharingToShares.feature#L221) @@ -602,18 +596,12 @@ Scenario Outline: Moving a file into a shared folder as the sharee and as the sh - [apiWebdavMove2/moveShareOnOcis.feature:30](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavMove2/moveShareOnOcis.feature#L30) - [apiWebdavMove2/moveShareOnOcis.feature:32](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavMove2/moveShareOnOcis.feature#L32) - Scenario Outline: Moving a file out of a shared folder as the sharee and as the sharer -- [apiWebdavMove2/moveShareOnOcis.feature:60](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavMove2/moveShareOnOcis.feature#L60) -- [apiWebdavMove2/moveShareOnOcis.feature:62](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavMove2/moveShareOnOcis.feature#L62) Scenario Outline: Moving a folder into a shared folder as the sharee and as the sharer -- [apiWebdavMove2/moveShareOnOcis.feature:91](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavMove2/moveShareOnOcis.feature#L91) -- [apiWebdavMove2/moveShareOnOcis.feature:93](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavMove2/moveShareOnOcis.feature#L93) - Scenario Outline: Moving a folder out of a shared folder as the sharee and as the sharer -- [apiWebdavMove2/moveShareOnOcis.feature:124](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavMove2/moveShareOnOcis.feature#L124) -- [apiWebdavMove2/moveShareOnOcis.feature:126](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavMove2/moveShareOnOcis.feature#L126) +- [apiWebdavMove2/moveShareOnOcis.feature:98](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavMove2/moveShareOnOcis.feature#L98) +- [apiWebdavMove2/moveShareOnOcis.feature:100](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavMove2/moveShareOnOcis.feature#L100) Scenario Outline: Moving a file to a shared folder with no permissions -- [apiWebdavMove2/moveShareOnOcis.feature:152](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavMove2/moveShareOnOcis.feature#L152) -- [apiWebdavMove2/moveShareOnOcis.feature:153](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavMove2/moveShareOnOcis.feature#L153) +- [apiWebdavMove2/moveShareOnOcis.feature:169](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavMove2/moveShareOnOcis.feature#L169) +- [apiWebdavMove2/moveShareOnOcis.feature:170](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavMove2/moveShareOnOcis.feature#L170) #### [restoring an older version of a shared file deletes the share](https://github.com/owncloud/ocis/issues/765) @@ -742,17 +730,6 @@ Scenario Outline: Moving a file into a shared folder as the sharee and as the sh - [apiShareReshareToShares3/reShareWithExpiryDate.feature:234](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareReshareToShares3/reShareWithExpiryDate.feature#L234) - [apiShareReshareToShares3/reShareWithExpiryDate.feature:235](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareReshareToShares3/reShareWithExpiryDate.feature#L235) -#### [incorrect ocs(v2) status value when sharing to group that does not exist should be 404, gives 998](https://github.com/owncloud/product/issues/250) - -_ocs: api compatibility, return correct status code_ - -- [apiShareCreateSpecialToShares2/createShareGroupCaseSensitive.feature:85](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareCreateSpecialToShares2/createShareGroupCaseSensitive.feature#L85) -- [apiShareCreateSpecialToShares2/createShareGroupCaseSensitive.feature:86](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareCreateSpecialToShares2/createShareGroupCaseSensitive.feature#L86) -- [apiShareCreateSpecialToShares2/createShareGroupCaseSensitive.feature:87](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareCreateSpecialToShares2/createShareGroupCaseSensitive.feature#L87) -- [apiShareCreateSpecialToShares2/createShareGroupCaseSensitive.feature:88](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareCreateSpecialToShares2/createShareGroupCaseSensitive.feature#L88) -- [apiShareCreateSpecialToShares2/createShareGroupCaseSensitive.feature:89](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareCreateSpecialToShares2/createShareGroupCaseSensitive.feature#L89) -- [apiShareCreateSpecialToShares2/createShareGroupCaseSensitive.feature:90](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareCreateSpecialToShares2/createShareGroupCaseSensitive.feature#L90) - #### [Cannot move folder/file from one received share to another](https://github.com/owncloud/ocis/issues/2442) - [apiShareUpdateToShares/updateShare.feature:242](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareUpdateToShares/updateShare.feature#L242) @@ -918,71 +895,20 @@ _ocdav: api compatibility, return correct status code_ - [apiFavorites/favorites.feature:116](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiFavorites/favorites.feature#L116) - [apiFavorites/favorites.feature:141](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiFavorites/favorites.feature#L141) - [apiFavorites/favorites.feature:142](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiFavorites/favorites.feature#L142) -- [apiFavorites/favorites.feature:267](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiFavorites/favorites.feature#L267) -- [apiFavorites/favorites.feature:268](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiFavorites/favorites.feature#L268) +- [apiFavorites/favorites.feature:262](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiFavorites/favorites.feature#L262) +- [apiFavorites/favorites.feature:263](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiFavorites/favorites.feature#L263) And other missing implementation of favorites -- [apiFavorites/favorites.feature:162](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiFavorites/favorites.feature#L162) -- [apiFavorites/favorites.feature:163](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiFavorites/favorites.feature#L163) -- [apiFavorites/favorites.feature:187](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiFavorites/favorites.feature#L187) +- [apiFavorites/favorites.feature:182](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiFavorites/favorites.feature#L182) +- [apiFavorites/favorites.feature:183](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiFavorites/favorites.feature#L183) - [apiFavorites/favorites.feature:188](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiFavorites/favorites.feature#L188) -- [apiFavorites/favorites.feature:193](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiFavorites/favorites.feature#L193) -- [apiFavorites/favorites.feature:220](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiFavorites/favorites.feature#L220) +- [apiFavorites/favorites.feature:215](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiFavorites/favorites.feature#L215) +- [apiFavorites/favorites.feature:216](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiFavorites/favorites.feature#L216) - [apiFavorites/favorites.feature:221](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiFavorites/favorites.feature#L221) -- [apiFavorites/favorites.feature:226](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiFavorites/favorites.feature#L226) -- [apiFavorites/favoritesSharingToShares.feature:82](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiFavorites/favoritesSharingToShares.feature#L82) -- [apiFavorites/favoritesSharingToShares.feature:88](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiFavorites/favoritesSharingToShares.feature#L88) - -#### [resource inside Shares dir is not found using the spaces WebDAV API](https://github.com/owncloud/ocis/issues/2968) - -- [apiFavorites/favorites.feature:168](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiFavorites/favorites.feature#L168) -- [apiFavorites/favoritesSharingToShares.feature:28](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiFavorites/favoritesSharingToShares.feature#L28) -- [apiFavorites/favoritesSharingToShares.feature:48](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiFavorites/favoritesSharingToShares.feature#L48) - [apiFavorites/favoritesSharingToShares.feature:67](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiFavorites/favoritesSharingToShares.feature#L67) -- [apiFavorites/favoritesSharingToShares.feature:83](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiFavorites/favoritesSharingToShares.feature#L83) -- [apiFavorites/favoritesSharingToShares.feature:108](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiFavorites/favoritesSharingToShares.feature#L108) -- [apiWebdavUploadTUS/uploadToShare.feature:31](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavUploadTUS/uploadToShare.feature#L31) -- [apiWebdavUploadTUS/uploadToShare.feature:50](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavUploadTUS/uploadToShare.feature#L50) -- [apiWebdavUploadTUS/uploadToShare.feature:72](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavUploadTUS/uploadToShare.feature#L72) -- [apiWebdavUploadTUS/uploadToShare.feature:93](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavUploadTUS/uploadToShare.feature#L93) -- [apiWebdavUploadTUS/uploadToShare.feature:135](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavUploadTUS/uploadToShare.feature#L135) -- [apiWebdavUploadTUS/uploadToShare.feature:159](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavUploadTUS/uploadToShare.feature#L159) -- [apiWebdavUploadTUS/uploadToShare.feature:182](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavUploadTUS/uploadToShare.feature#L182) -- [apiWebdavUploadTUS/uploadToShare.feature:205](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavUploadTUS/uploadToShare.feature#L205) -- [apiWebdavUploadTUS/uploadToShare.feature:230](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavUploadTUS/uploadToShare.feature#L230) -- [apiWebdavUploadTUS/uploadToShare.feature:254](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavUploadTUS/uploadToShare.feature#L254) -- [apiWebdavUploadTUS/uploadToShare.feature:301](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavUploadTUS/uploadToShare.feature#L301) -- [apiWebdavUploadTUS/uploadToShare.feature:326](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavUploadTUS/uploadToShare.feature#L326) -- [apiWebdavEtagPropagation1/deleteFileFolder.feature:120](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavEtagPropagation1/deleteFileFolder.feature#L120) -- [apiWebdavEtagPropagation1/deleteFileFolder.feature:156](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavEtagPropagation1/deleteFileFolder.feature#L156) -- [apiWebdavEtagPropagation1/deleteFileFolder.feature:194](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavEtagPropagation1/deleteFileFolder.feature#L194) -- [apiWebdavEtagPropagation1/deleteFileFolder.feature:232](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavEtagPropagation1/deleteFileFolder.feature#L232) -- [apiWebdavLocks2/resharedSharesToShares.feature:117](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/resharedSharesToShares.feature#L117) -- [apiWebdavLocks2/resharedSharesToShares.feature:118](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/resharedSharesToShares.feature#L118) -- [apiWebdavLocks2/resharedSharesToShares.feature:144](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/resharedSharesToShares.feature#L144) -- [apiWebdavLocks2/resharedSharesToShares.feature:145](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/resharedSharesToShares.feature#L145) -- [apiWebdavLocks2/setTimeoutSharesToShares.feature:46](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/setTimeoutSharesToShares.feature#L46) -- [apiWebdavLocks2/setTimeoutSharesToShares.feature:47](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/setTimeoutSharesToShares.feature#L47) -- [apiWebdavLocks2/setTimeoutSharesToShares.feature:48](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/setTimeoutSharesToShares.feature#L48) -- [apiWebdavLocks2/setTimeoutSharesToShares.feature:49](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/setTimeoutSharesToShares.feature#L49) -- [apiWebdavLocks2/setTimeoutSharesToShares.feature:50](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/setTimeoutSharesToShares.feature#L50) -- [apiWebdavLocks2/setTimeoutSharesToShares.feature:80](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/setTimeoutSharesToShares.feature#L80) -- [apiWebdavLocks2/setTimeoutSharesToShares.feature:81](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/setTimeoutSharesToShares.feature#L81) -- [apiWebdavLocks2/setTimeoutSharesToShares.feature:82](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/setTimeoutSharesToShares.feature#L82) -- [apiWebdavLocks2/setTimeoutSharesToShares.feature:83](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/setTimeoutSharesToShares.feature#L83) -- [apiWebdavLocks2/setTimeoutSharesToShares.feature:84](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/setTimeoutSharesToShares.feature#L84) -- [apiShareOperationsToShares1/changingFilesShare.feature:98](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareOperationsToShares1/changingFilesShare.feature#L98) -- [apiShareOperationsToShares1/changingFilesShare.feature:173](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareOperationsToShares1/changingFilesShare.feature#L173) -- [apiWebdavMove2/moveShareOnOcis.feature:38](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavMove2/moveShareOnOcis.feature#L38) -- [apiWebdavMove2/moveShareOnOcis.feature:39](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavMove2/moveShareOnOcis.feature#L39) -- [apiWebdavMove2/moveShareOnOcis.feature:68](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavMove2/moveShareOnOcis.feature#L68) -- [apiWebdavMove2/moveShareOnOcis.feature:99](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavMove2/moveShareOnOcis.feature#L99) -- [apiWebdavMove2/moveShareOnOcis.feature:100](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavMove2/moveShareOnOcis.feature#L100) -- [apiWebdavMove2/moveShareOnOcis.feature:132](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavMove2/moveShareOnOcis.feature#L132) -- [apiWebdavMove2/moveShareOnOcis.feature:158](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavMove2/moveShareOnOcis.feature#L158) -- [apiWebdavMove2/moveShareOnOcis.feature:185](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavMove2/moveShareOnOcis.feature#L185) -- [apiWebdavMove2/moveShareOnOcis.feature:220](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavMove2/moveShareOnOcis.feature#L220) +- [apiFavorites/favoritesSharingToShares.feature:68](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiFavorites/favoritesSharingToShares.feature#L68) + #### [WWW-Authenticate header for unauthenticated requests is not clear](https://github.com/owncloud/ocis/issues/2285) @@ -1099,18 +1025,16 @@ And other missing implementation of favorites - [apiWebdavUploadTUS/optionsRequest.feature:21](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavUploadTUS/optionsRequest.feature#L21) - [apiWebdavUploadTUS/optionsRequest.feature:33](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavUploadTUS/optionsRequest.feature#L33) - [apiWebdavUploadTUS/optionsRequest.feature:47](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavUploadTUS/optionsRequest.feature#L47) -- [apiWebdavUploadTUS/uploadToShare.feature:224](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavUploadTUS/uploadToShare.feature#L224) -- [apiWebdavUploadTUS/uploadToShare.feature:225](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavUploadTUS/uploadToShare.feature#L225) -- [apiWebdavUploadTUS/uploadToShare.feature:248](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavUploadTUS/uploadToShare.feature#L248) -- [apiWebdavUploadTUS/uploadToShare.feature:249](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavUploadTUS/uploadToShare.feature#L249) -- [apiWebdavUploadTUS/uploadToShare.feature:272](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavUploadTUS/uploadToShare.feature#L272) -- [apiWebdavUploadTUS/uploadToShare.feature:273](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavUploadTUS/uploadToShare.feature#L273) -- [apiWebdavUploadTUS/uploadToShare.feature:278](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavUploadTUS/uploadToShare.feature#L278) -- [apiWebdavUploadTUS/uploadToShare.feature:320](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavUploadTUS/uploadToShare.feature#L320) -- [apiWebdavUploadTUS/uploadToShare.feature:321](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavUploadTUS/uploadToShare.feature#L321) -- [apiWebdavUploadTUS/uploadToShare.feature:372](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavUploadTUS/uploadToShare.feature#L372) -- [apiWebdavUploadTUS/uploadToShare.feature:373](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavUploadTUS/uploadToShare.feature#L373) -- [apiWebdavUploadTUS/uploadToShare.feature:378](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavUploadTUS/uploadToShare.feature#L378) +- [apiWebdavUploadTUS/uploadToShare.feature:181](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavUploadTUS/uploadToShare.feature#L181) +- [apiWebdavUploadTUS/uploadToShare.feature:182](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavUploadTUS/uploadToShare.feature#L182) +- [apiWebdavUploadTUS/uploadToShare.feature:200](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavUploadTUS/uploadToShare.feature#L200) +- [apiWebdavUploadTUS/uploadToShare.feature:201](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavUploadTUS/uploadToShare.feature#L201) +- [apiWebdavUploadTUS/uploadToShare.feature:219](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavUploadTUS/uploadToShare.feature#L219) +- [apiWebdavUploadTUS/uploadToShare.feature:220](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavUploadTUS/uploadToShare.feature#L220) +- [apiWebdavUploadTUS/uploadToShare.feature:258](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavUploadTUS/uploadToShare.feature#L258) +- [apiWebdavUploadTUS/uploadToShare.feature:259](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavUploadTUS/uploadToShare.feature#L259) +- [apiWebdavUploadTUS/uploadToShare.feature:300](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavUploadTUS/uploadToShare.feature#L300) +- [apiWebdavUploadTUS/uploadToShare.feature:301](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavUploadTUS/uploadToShare.feature#L301) #### [TUS OPTIONS requests do not reply with TUS headers when invalid password](https://github.com/owncloud/ocis/issues/1012) @@ -1279,14 +1203,6 @@ Not everything needs to be implemented for ocis. While the oc10 testsuite covers - [apiShareManagementToShares/moveShareInsideAnotherShare.feature:86](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareManagementToShares/moveShareInsideAnotherShare.feature#L86) - [apiShareManagementToShares/moveShareInsideAnotherShare.feature:100](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareManagementToShares/moveShareInsideAnotherShare.feature#L100) -#### [unable to create resource using TUS inside Shares dir](https://github.com/owncloud/ocis/issues/3048) - -- [apiWebdavUploadTUS/uploadFileMtimeShares.feature:33](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavUploadTUS/uploadFileMtimeShares.feature#L33) -- [apiWebdavUploadTUS/uploadFileMtimeShares.feature:52](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavUploadTUS/uploadFileMtimeShares.feature#L52) -- [apiWebdavUploadTUS/uploadFileMtimeShares.feature:73](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavUploadTUS/uploadFileMtimeShares.feature#L73) -- [apiWebdavUploadTUS/uploadFileMtimeShares.feature:94](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavUploadTUS/uploadFileMtimeShares.feature#L94) -- [apiWebdavUploadTUS/uploadToShare.feature:352](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavUploadTUS/uploadToShare.feature#L352) - #### [Renaming resource to banned name is allowed in spaces webdav](https://github.com/owncloud/ocis/issues/3099) - [apiWebdavMove1/moveFolder.feature:27](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavMove1/moveFolder.feature#L27) @@ -1301,7 +1217,7 @@ Not everything needs to be implemented for ocis. While the oc10 testsuite covers - [apiFavorites/favorites.feature:121](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiFavorites/favorites.feature#L121) - [apiFavorites/favorites.feature:147](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiFavorites/favorites.feature#L147) -- [apiFavorites/favorites.feature:273](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiFavorites/favorites.feature#L273) +- [apiFavorites/favorites.feature:268](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiFavorites/favorites.feature#L268) #### [could not create system tag](https://github.com/owncloud/ocis/issues/3092) @@ -1319,13 +1235,6 @@ Not everything needs to be implemented for ocis. While the oc10 testsuite covers - [apiWebdavOperations/listFiles.feature:442](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavOperations/listFiles.feature#L442) - [apiWebdavOperations/listFiles.feature:448](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavOperations/listFiles.feature#L448) -### [[spaces webdav] upload to a share that was locked by owner ends with status code 409](https://github.com/owncloud/ocis/issues/3128) - -- [apiWebdavLocks2/resharedSharesToShares.feature:39](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/resharedSharesToShares.feature#L39) -- [apiWebdavLocks2/resharedSharesToShares.feature:40](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/resharedSharesToShares.feature#L40) -- [apiWebdavLocks2/resharedSharesToShares.feature:69](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/resharedSharesToShares.feature#L69) -- [apiWebdavLocks2/resharedSharesToShares.feature:70](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/resharedSharesToShares.feature#L70) - #### [Renaming resource to excluded directory name is allowed in spaces webdav](https://github.com/owncloud/ocis/issues/3102) - [apiWebdavMove2/moveFileToExcludedDirectory.feature:26](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavMove2/moveFileToExcludedDirectory.feature#L26) @@ -1344,15 +1253,6 @@ Not everything needs to be implemented for ocis. While the oc10 testsuite covers - [apiWebdavOperations/refuseAccess.feature:36](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavOperations/refuseAccess.feature#L36) - [apiWebdavOperations/refuseAccess.feature:41](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavOperations/refuseAccess.feature#L41) -### [GraphAPI groups are case in-sensitive](https://github.com/owncloud/ocis/issues/4291) - -- [apiShareCreateSpecialToShares2/createShareGroupCaseSensitive.feature:49](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareCreateSpecialToShares2/createShareGroupCaseSensitive.feature#L49) -- [apiShareCreateSpecialToShares2/createShareGroupCaseSensitive.feature:50](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareCreateSpecialToShares2/createShareGroupCaseSensitive.feature#L50) -- [apiShareCreateSpecialToShares2/createShareGroupCaseSensitive.feature:51](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareCreateSpecialToShares2/createShareGroupCaseSensitive.feature#L51) -- [apiShareCreateSpecialToShares2/createShareGroupCaseSensitive.feature:52](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareCreateSpecialToShares2/createShareGroupCaseSensitive.feature#L52) -- [apiShareCreateSpecialToShares2/createShareGroupCaseSensitive.feature:53](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareCreateSpecialToShares2/createShareGroupCaseSensitive.feature#L53) -- [apiShareCreateSpecialToShares2/createShareGroupCaseSensitive.feature:54](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareCreateSpecialToShares2/createShareGroupCaseSensitive.feature#L54) - #### [OCS status code zero](https://github.com/owncloud/ocis/issues/3621) - [apiShareManagementToShares/moveReceivedShare.feature:32](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareManagementToShares/moveReceivedShare.feature#L32) @@ -1397,5 +1297,9 @@ Not everything needs to be implemented for ocis. While the oc10 testsuite covers - [apiTrashbin/trashbinFilesFolders.feature:438](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiTrashbin/trashbinFilesFolders.feature#L438) - [apiTrashbin/trashbinFilesFolders.feature:475](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiTrashbin/trashbinFilesFolders.feature#L475) +#### [valid WebDAV (DELETE, COPY or MOVE) requests with body must exit with 415](https://github.com/owncloud/ocis/issues/4332) +- [apiAuthWebDav/webDavDELETEAuth.feature:188](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiAuthWebDav/webDavDELETEAuth.feature#L188) +- [apiAuthWebDav/webDavDELETEAuth.feature:199](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiAuthWebDav/webDavDELETEAuth.feature#L199) + Note: always have an empty line at the end of this file. The bash script that processes this file requires that the last line has a newline on the end. diff --git a/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md b/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md index 0170f03fe79..a636c8ba43b 100644 --- a/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md +++ b/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md @@ -21,7 +21,3 @@ The expected failures in this file are from features in the owncloud/ocis repo. ### [Search by shares jail works incorrect](https://github.com/owncloud/ocis/issues/4014) - [apiSpaces/search.feature:43](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/search.feature#L43) - -### [Changing personal drive quota on another user as admin is not possible](https://github.com/owncloud/ocis/issues/4325) -- [apiSpaces/changeSpaces.feature:221](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/changeSpaces.feature#L221) - diff --git a/tests/acceptance/features/apiSpaces/etagPropagation.feature b/tests/acceptance/features/apiSpaces/etagPropagation.feature index c861a894812..bd93c6598a0 100644 --- a/tests/acceptance/features/apiSpaces/etagPropagation.feature +++ b/tests/acceptance/features/apiSpaces/etagPropagation.feature @@ -81,7 +81,7 @@ Feature: check etag propagation after different file alterations | Alice | / | Personal | | Alice | /upload | Personal | | Brian | / | Shares Jail | - | Brian | /upload | Shares Jail | + | Brian | /upload | Shares Jail | And these etags should not have changed | user | path | space | | Alice | /upload/renamed.txt | Personal | @@ -105,7 +105,7 @@ Feature: check etag propagation after different file alterations | Alice | / | Personal | | Alice | /upload | Personal | | Brian | / | Shares Jail | - | Brian | /upload | Shares Jail | + | Brian | /upload | Shares Jail | And these etags should not have changed | user | path | space | | Alice | /upload/renamed.txt | Personal | @@ -186,7 +186,7 @@ Feature: check etag propagation after different file alterations | Brian | / | Shares Jail | | Brian | /upload | Shares Jail | | Brian | /dst | Shares Jail | - + Scenario: as share reciever moving a folder from one folder to an other changes the etags of both folders for all collaborators Given user "Alice" has created folder "/dst" @@ -229,7 +229,7 @@ Feature: check etag propagation after different file alterations | Brian | / | Shares Jail | | Brian | /upload | Shares Jail | - + Scenario: as sharer creating a folder inside a shared folder changes etag for all collaborators Given user "Alice" has shared folder "/upload" with user "Brian" And user "Brian" has accepted share "/upload" offered by user "Alice" @@ -261,10 +261,10 @@ Feature: check etag propagation after different file alterations | Alice | / | Personal | | Alice | /upload | Personal | | Brian | / | Shares Jail | - | Brian | /upload | Shares Jail | + | Brian | /upload | Shares Jail | - Scenario: as sharer uploading a file inside a shared folder should update etags for all collaborators + Scenario: as sharer uploading a file inside a shared folder should update etags for all collaborators Given user "Alice" has shared folder "/upload" with user "Brian" And user "Brian" has accepted share "/upload" offered by user "Alice" And user "Alice" has stored etag of element "/" inside space "Personal" @@ -298,8 +298,8 @@ Feature: check etag propagation after different file alterations | Brian | / | Shares Jail | | Brian | /upload | Shares Jail | - - Scenario: as sharer overwriting a file inside a shared folder should update etags for all collaborators + + Scenario: as sharer overwriting a file inside a shared folder should update etags for all collaborators Given user "Alice" has uploaded file with content "uploaded content" to "/upload/file.txt" And user "Alice" has shared folder "/upload" with user "Brian" And user "Brian" has accepted share "/upload" offered by user "Alice" @@ -315,3 +315,111 @@ Feature: check etag propagation after different file alterations | Alice | /upload | Personal | | Brian | / | Shares Jail | | Brian | /upload | Shares Jail | + + + Scenario: As share receiver deleting (removing) a file changes the etags of all parents for all collaborators + Given user "Alice" has created folder "/upload/sub" + And user "Alice" has uploaded file with content "uploaded content" to "/upload/sub/file.txt" + And user "Alice" has shared folder "/upload" with user "Brian" + And user "Brian" has accepted share "/upload" offered by user "Alice" + And user "Alice" has stored etag of element "/" inside space "Personal" + And user "Alice" has stored etag of element "/upload" inside space "Personal" + And user "Alice" has stored etag of element "/upload/sub" inside space "Personal" + And user "Brian" has stored etag of element "/" inside space "Personal" + And user "Brian" has stored etag of element "/" inside space "Shares Jail" + And user "Brian" has stored etag of element "/upload" inside space "Shares Jail" + And user "Brian" has stored etag of element "/upload/sub" inside space "Shares Jail" + When user "Brian" removes the file "upload/sub/file.txt" from space "Shares Jail" + Then the HTTP status code should be "204" + And these etags should have changed + | user | path | space | + | Alice | / | Personal | + | Alice | /upload | Personal | + | Alice | /upload/sub | Personal | + | Brian | / | Shares Jail | + | Brian | /upload | Shares Jail | + | Brian | /upload/sub | Shares Jail | + And these etags should not have changed + | user | path | space | + | Brian | / | Personal | + + + Scenario: As sharer deleting (removing) a file changes the etags of all parents for all collaborators + Given user "Alice" has created folder "/upload/sub" + And user "Alice" has uploaded file with content "uploaded content" to "/upload/sub/file.txt" + And user "Alice" has shared folder "/upload" with user "Brian" + And user "Brian" has accepted share "/upload" offered by user "Alice" + And user "Alice" has stored etag of element "/" inside space "Personal" + And user "Alice" has stored etag of element "/upload" inside space "Personal" + And user "Alice" has stored etag of element "/upload/sub" inside space "Personal" + And user "Brian" has stored etag of element "/" inside space "Personal" + And user "Brian" has stored etag of element "/" inside space "Shares Jail" + And user "Brian" has stored etag of element "/upload" inside space "Shares Jail" + And user "Brian" has stored etag of element "/upload/sub" inside space "Shares Jail" + When user "Alice" removes the file "upload/sub/file.txt" from space "Personal" + Then the HTTP status code should be "204" + And these etags should have changed + | user | path | space | + | Alice | / | Personal | + | Alice | /upload | Personal | + | Alice | /upload/sub | Personal | + | Brian | / | Shares Jail | + | Brian | /upload | Shares Jail | + | Brian | /upload/sub | Shares Jail | + And these etags should not have changed + | user | path | space | + | Brian | / | Personal | + + + Scenario: As share receiver deleting (removing) a folder changes the etags of all parents for all collaborators + Given user "Alice" has created folder "/upload/sub" + And user "Alice" has created folder "/upload/sub/toDelete" + And user "Alice" has shared folder "/upload" with user "Brian" + And user "Brian" has accepted share "/upload" offered by user "Alice" + And user "Alice" has stored etag of element "/" inside space "Personal" + And user "Alice" has stored etag of element "/upload" inside space "Personal" + And user "Alice" has stored etag of element "/upload/sub" inside space "Personal" + And user "Brian" has stored etag of element "/" inside space "Personal" + And user "Brian" has stored etag of element "/" inside space "Shares Jail" + And user "Brian" has stored etag of element "/upload" inside space "Shares Jail" + And user "Brian" has stored etag of element "/upload/sub" inside space "Shares Jail" + When user "Brian" removes the file "upload/sub/toDelete" from space "Shares Jail" + Then the HTTP status code should be "204" + And these etags should have changed + | user | path | space | + | Alice | / | Personal | + | Alice | /upload | Personal | + | Alice | /upload/sub | Personal | + | Brian | / | Shares Jail | + | Brian | /upload | Shares Jail | + | Brian | /upload/sub | Shares Jail | + And these etags should not have changed + | user | path | space | + | Brian | / | Personal | + + + Scenario: As sharer deleting (removing) a folder changes the etags of all parents for all collaborators + Given user "Alice" has created folder "/upload/sub" + And user "Alice" has created folder "/upload/sub/toDelete" + And user "Alice" has shared folder "/upload" with user "Brian" + And user "Brian" has accepted share "/upload" offered by user "Alice" + And user "Alice" has stored etag of element "/" inside space "Personal" + And user "Alice" has stored etag of element "/upload" inside space "Personal" + And user "Alice" has stored etag of element "/upload/sub" inside space "Personal" + And user "Brian" has stored etag of element "/" inside space "Personal" + And user "Brian" has stored etag of element "/" inside space "Shares Jail" + And user "Brian" has stored etag of element "/upload" inside space "Shares Jail" + And user "Brian" has stored etag of element "/upload/sub" inside space "Shares Jail" + When user "Alice" removes the file "upload/sub/toDelete" from space "Personal" + Then the HTTP status code should be "204" + And these etags should have changed + | user | path | space | + | Alice | / | Personal | + | Alice | /upload | Personal | + | Alice | /upload/sub | Personal | + | Brian | / | Shares Jail | + | Brian | /upload | Shares Jail | + | Brian | /upload/sub | Shares Jail | + And these etags should not have changed + | user | path | space | + | Brian | / | Personal | diff --git a/tests/acceptance/features/bootstrap/SpacesContext.php b/tests/acceptance/features/bootstrap/SpacesContext.php index 470a9d0fd9b..590b085a7c2 100644 --- a/tests/acceptance/features/bootstrap/SpacesContext.php +++ b/tests/acceptance/features/bootstrap/SpacesContext.php @@ -126,14 +126,8 @@ class SpacesContext implements Context { $this->createdSpaces[$spaceName] = $spaceCreator; } - /** - * @var array - */ - private array $availableSpaces; + private array $availableSpaces = []; - /** - * @var array - */ private array $lastPublicLinkData = []; /** @@ -378,7 +372,7 @@ class SpacesContext implements Context { /** * using method from core to set share data - * + * * @return void */ public function setLastShareData(): void { @@ -428,11 +422,11 @@ class SpacesContext implements Context { public function cleanDataAfterTests(): void { // TODO enable when admin can disable and delete spaces // $this->deleteAllSpacesOfTheType('project'); - // $this->deleteAllSpacesOfTheType('personal'); + $this->deleteAllPersonalSpaces(); } /** - * The method first disables and then deletes spaces + * Admin first disables and then deletes spaces * * @param string $driveType * @@ -463,6 +457,32 @@ class SpacesContext implements Context { } } + /** + * users delete their personal space at the end of the test + * + * @return void + * + * @throws Exception|GuzzleException + */ + public function deleteAllPersonalSpaces(): void { + $query = "\$filter=driveType eq personal"; + $createdUsers= $this->featureContext->getCreatedUsers(); + + foreach($createdUsers as $user) { + $this->theUserListsAllHisAvailableSpacesUsingTheGraphApi( + $user["actualUsername"], + $query + ); + $drives = $this->getAvailableSpaces(); + foreach ($drives as $value) { + if (!\array_key_exists("deleted", $value["root"])) { + $this->sendDisableSpaceRequest($user["actualUsername"], $value["name"]); + } + $this->sendDeleteSpaceRequest($user["actualUsername"], $value["name"]); + } + } + } + /** * Send Graph List My Spaces Request * @@ -2215,7 +2235,7 @@ class SpacesContext implements Context { string $spaceName ): void { $space = $this->getSpaceByName($user, $spaceName); - $spaceWebDavUrl = $space["root"]["webDavUrl"] . '/' . $object; + $spaceWebDavUrl = $space["root"]["webDavUrl"] . '/' . ltrim($object, "/"); $this->featureContext->setResponse( HttpRequestHelper::delete( $spaceWebDavUrl, @@ -3013,7 +3033,7 @@ class SpacesContext implements Context { $space = $this->getSpaceByName($user, $spaceName); $body = $space['id']; } - + $url = "/apps/files_sharing/api/v1/shares?reshares=true&space_ref=" . $body; $this->ocsContext->userSendsHTTPMethodToOcsApiEndpointWithBody( @@ -3035,7 +3055,7 @@ class SpacesContext implements Context { Assert::assertEmpty($responseArray, __METHOD__ . ' Response should be empty'); } } - + /** * @When /^user "([^"]*)" gets the following properties of (?:file|folder|entry|resource) "([^"]*)" inside space "([^"]*)" using the WebDAV API$/ * diff --git a/tests/config/drone/ocis-config.json b/tests/config/drone/ocis-config.json index d8ee1513fb8..5c181dedd07 100644 --- a/tests/config/drone/ocis-config.json +++ b/tests/config/drone/ocis-config.json @@ -31,10 +31,6 @@ { "id": "settings", "path": "https://ocis-server:9200/settings.js" - }, - { - "id": "accounts", - "path": "https://ocis-server:9200/accounts.js" } ] } diff --git a/vendor-bin/behat/composer.json b/vendor-bin/behat/composer.json index 00964ecb4b8..999f00df863 100644 --- a/vendor-bin/behat/composer.json +++ b/vendor-bin/behat/composer.json @@ -2,7 +2,10 @@ "config" : { "platform": { "php": "7.4" - } + }, + "allow-plugins": { + "composer/package-versions-deprecated": true + } }, "require": { "behat/behat": "^3.9",