From e668da8cf5cf9b090745a978f05bc3c8fce78c04 Mon Sep 17 00:00:00 2001 From: mrkvon Date: Sat, 17 Feb 2024 00:08:08 +0100 Subject: [PATCH] Fix production bugs (#6) Bugs discovered while deploying the service to production: - URIs with # in .env need to be quoted - fix ctx.response.body is not a function And random .vscode settings change --- .env.sample | 4 ++-- .vscode/settings.json | 2 +- README.md | 4 +++- src/controllers/integration.ts | 6 +++--- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.env.sample b/.env.sample index b3b403b..f9910c9 100644 --- a/.env.sample +++ b/.env.sample @@ -13,7 +13,7 @@ BEHIND_PROXY= MAILER_IDENTITY_EMAIL=bot@example MAILER_IDENTITY_PASSWORD=password MAILER_IDENTITY_PROVIDER=http://localhost:3456 -MAILER_IDENTITY_WEBID=http://localhost:3456/bot/profile/card#me +MAILER_IDENTITY_WEBID="http://localhost:3456/bot/profile/card#me" MAILER_IDENTITY_CSS_VERSION=7 # supported versions are 6 and 7 # link to group of users who are allowed to use the service @@ -44,4 +44,4 @@ JWT_KEY=./ecdsa-p256-private.pem JWT_ALG=ES256 # type index class by which we find settings with email -EMAIL_DISCOVERY_TYPE=http://w3id.org/hospex/ns#PersonalHospexDocument +EMAIL_DISCOVERY_TYPE="http://w3id.org/hospex/ns#PersonalHospexDocument" diff --git a/.vscode/settings.json b/.vscode/settings.json index c301aae..71fe80e 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -2,6 +2,6 @@ "editor.defaultFormatter": "esbenp.prettier-vscode", "editor.formatOnSave": true, "editor.codeActionsOnSave": { - "source.organizeImports": true + "source.organizeImports": "explicit" } } diff --git a/README.md b/README.md index 022e00f..fe4899b 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,9 @@ Email address and verification token should be stored in (webId) - space:prefere To authenticate itself, the mailer needs to have its own identity, it can be identity hosted on some Community Solid Server -Copy `.env.sample` to `.env` and edit the latter according to your needs +Copy `.env.sample` to `.env` and edit the latter according to your needs. + +_:warning: If you provide URIs with `#``, put them to `""`, otherwise # may be interpreted as comment!_ Alternatively, you may provide the configuration as environment variables diff --git a/src/controllers/integration.ts b/src/controllers/integration.ts index 9777e45..9ffb3ff 100644 --- a/src/controllers/integration.ts +++ b/src/controllers/integration.ts @@ -92,11 +92,11 @@ export const finishIntegration: Middleware = async ctx => { if (savedTokensCount === 0) { ctx.response.status = 400 ctx.set('content-type', 'application/json') - ctx.response.body({ + ctx.response.body = { error: - "We could't find any writeable location on your Pod to save the email verifiation token. You can write it manually.", + "We couldn't find any writeable location on your Pod to save the email verifiation token. You can write it manually.", token: jwt, - }) + } } else { ctx.response.body = jwt ctx.set('content-type', 'text/plain')