From 700d0dc4db7b18fc47adb74d694c99ffcc5a1920 Mon Sep 17 00:00:00 2001 From: thursday Date: Tue, 23 Nov 2021 17:34:02 -0500 Subject: Replace EXTERNAL_DOMAIN variable with APP_URL --- .env.example | 2 +- README.md | 2 +- app/Controllers/Http/ServiceController.js | 8 ++++---- config/mail.js | 2 +- docker/README.md | 4 ++-- docker/docker-compose.yml | 2 +- start/events.js | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.env.example b/.env.example index 6cd9ad3..36ae547 100644 --- a/.env.example +++ b/.env.example @@ -3,7 +3,7 @@ PORT=3333 NODE_ENV=development APP_NAME=Ferdi-server -EXTERNAL_DOMAIN=https://ferdi.domain.tld +APP_URL=localhost CACHE_VIEWS=false diff --git a/README.md b/README.md index d4f1371..a6a16c8 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ After setting up the docker container we recommend you set up an NGINX reverse p docker create \ --name=ferdi-server \ -e NODE_ENV=development \ - -e EXTERNAL_DOMAIN=https:// \ + -e APP_URL= \ -e DB_CONNECTION= \ -e DB_HOST= \ -e DB_PORT= \ diff --git a/app/Controllers/Http/ServiceController.js b/app/Controllers/Http/ServiceController.js index 3ce6acd..ef8b168 100644 --- a/app/Controllers/Http/ServiceController.js +++ b/app/Controllers/Http/ServiceController.js @@ -98,7 +98,7 @@ class ServiceController { workspaces: [], ...settings, iconUrl: settings.iconId - ? `${Env.get('EXTERNAL_DOMAIN')}/v1/icon/${settings.iconId}` + ? `${Env.get('APP_URL')}/v1/icon/${settings.iconId}` : null, id: service.serviceId, name: service.name, @@ -176,7 +176,7 @@ class ServiceController { id, name: service.name, ...newSettings, - iconUrl: `${Env.get('EXTERNAL_DOMAIN')}/v1/icon/${newSettings.iconId}`, + iconUrl: `${Env.get('APP_URL')}/v1/icon/${newSettings.iconId}`, userId: auth.user.id, }, status: ['updated'], @@ -223,7 +223,7 @@ class ServiceController { id, name: service.name, ...settings, - iconUrl: `${Env.get('EXTERNAL_DOMAIN')}/v1/icon/${settings.iconId}`, + iconUrl: `${Env.get('APP_URL')}/v1/icon/${settings.iconId}`, userId: auth.user.id, }, status: ['updated'], @@ -293,7 +293,7 @@ class ServiceController { workspaces: [], ...settings, iconUrl: settings.iconId - ? `${Env.get('EXTERNAL_DOMAIN')}/v1/icon/${settings.iconId}` + ? `${Env.get('APP_URL')}/v1/icon/${settings.iconId}` : null, id: service.serviceId, name: service.name, diff --git a/config/mail.js b/config/mail.js index da41ed4..2518772 100644 --- a/config/mail.js +++ b/config/mail.js @@ -25,7 +25,7 @@ module.exports = { smtp: { driver: 'smtp', pool: true, - name: Env.get('EXTERNAL_DOMAIN'), + name: Env.get('APP_URL'), port: Env.get('SMTP_PORT', '2525'), host: Env.get('SMTP_HOST', 'localhost'), secure: JSON.parse(Env.get('MAIL_SSL', 'false')), diff --git a/docker/README.md b/docker/README.md index 2d5e6ba..3cb49be 100644 --- a/docker/README.md +++ b/docker/README.md @@ -35,7 +35,7 @@ To create the docker container with the proper parameters: docker create \ --name=ferdi-server \ -e NODE_ENV=development \ - -e EXTERNAL_DOMAIN=https:// \ + -e APP_URL= \ -e DB_CONNECTION= \ -e DB_HOST= \ -e DB_PORT= \ @@ -79,7 +79,7 @@ Container images are configured using parameters passed at runtime (such as thos | :----: | --- | | `-p :3333` | Will map the container's port 3333 to a port on the host, default is 3333. See the [Docker docs](https://docs.docker.com/config/containers/container-networking/) for more information about port mapping | | `-e NODE_ENV=development` | for specifying Node environment, production or development, default is development **currently this should not be changed**. See the [Docker docs](https://docs.docker.com/) for more information on the use of environmental variables in [Command-line](https://docs.docker.com/engine/reference/commandline/run/#mount-volume--v---read-only) and [Docker Compose](https://docs.docker.com/compose/environment-variables/) | -| `-e EXTERNAL_DOMAIN=https://` | for specifying the external https domain address of the Ferdi-server | +| `-e APP_URL=` | for specifying the URL of the Ferdi-server, including `http://` or `https://` as relevant. | | `-e DB_CONNECTION=` | for specifying the database host, default is 127.0.0.1 | | `-e DB_PORT=` | for specifying the database port, default is 3306 | diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 3d3f66d..4902331 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -5,7 +5,7 @@ services: container_name: ferdi-server environment: - NODE_ENV=development - - EXTERNAL_DOMAIN=localhost + - APP_URL=localhost - DB_CONNECTION=sqlite - DB_HOST=127.0.0.1 - DB_PORT=3306 diff --git a/start/events.js b/start/events.js index b734797..481ad98 100644 --- a/start/events.js +++ b/start/events.js @@ -8,7 +8,7 @@ Hello ${user.username}, we received a request to reset your Ferdi account password. Use the link below to reset your password. If you didn't requested that your password be reset, please ignore this message. -${Env.get('EXTERNAL_DOMAIN')}/user/reset?token=${encodeURIComponent(token)} +${Env.get('APP_URL')}/user/reset?token=${encodeURIComponent(token)} This message was sent automatically. Please do not reply. `; -- cgit v1.2.3-54-g00ecf