diff options
author | Vijay A <avijayr@protonmail.com> | 2021-08-23 09:34:46 +0530 |
---|---|---|
committer | Vijay A <avijayr@protonmail.com> | 2021-08-23 09:34:46 +0530 |
commit | e5e50f4d7a8a24cb1061b563759108ffd0140825 (patch) | |
tree | 58df2e8fc2ee6ba3a0ef95cd7d8fc4032d95f4ce /src/internal-server/app/Controllers/Http/ServiceController.js | |
parent | 5.6.1-nightly.36 [skip ci] (diff) | |
download | ferdium-app-e5e50f4d7a8a24cb1061b563759108ffd0140825.tar.gz ferdium-app-e5e50f4d7a8a24cb1061b563759108ffd0140825.tar.zst ferdium-app-e5e50f4d7a8a24cb1061b563759108ffd0140825.zip |
refactor: Reuse constants and utility functions to remove hardcoding/duplication
Diffstat (limited to 'src/internal-server/app/Controllers/Http/ServiceController.js')
-rw-r--r-- | src/internal-server/app/Controllers/Http/ServiceController.js | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/internal-server/app/Controllers/Http/ServiceController.js b/src/internal-server/app/Controllers/Http/ServiceController.js index 312306abf..f2af9d411 100644 --- a/src/internal-server/app/Controllers/Http/ServiceController.js +++ b/src/internal-server/app/Controllers/Http/ServiceController.js | |||
@@ -6,6 +6,7 @@ const uuid = require('uuid/v4'); | |||
6 | const path = require('path'); | 6 | const path = require('path'); |
7 | const fs = require('fs-extra'); | 7 | const fs = require('fs-extra'); |
8 | const { LOCAL_HOSTNAME, DEFAULT_SERVICE_ORDER } = require('../../../../config'); | 8 | const { LOCAL_HOSTNAME, DEFAULT_SERVICE_ORDER } = require('../../../../config'); |
9 | const { API_VERSION } = require('../../../../environment'); | ||
9 | 10 | ||
10 | const hostname = LOCAL_HOSTNAME; | 11 | const hostname = LOCAL_HOSTNAME; |
11 | const port = Env.get('PORT'); | 12 | const port = Env.get('PORT'); |
@@ -88,7 +89,7 @@ class ServiceController { | |||
88 | workspaces: [], | 89 | workspaces: [], |
89 | ...JSON.parse(service.settings), | 90 | ...JSON.parse(service.settings), |
90 | iconUrl: settings.iconId | 91 | iconUrl: settings.iconId |
91 | ? `http://${hostname}:${port}/v1/icon/${settings.iconId}` | 92 | ? `http://${hostname}:${port}/${API_VERSION}/icon/${settings.iconId}` |
92 | : null, | 93 | : null, |
93 | id: service.serviceId, | 94 | id: service.serviceId, |
94 | name: service.name, | 95 | name: service.name, |
@@ -156,7 +157,7 @@ class ServiceController { | |||
156 | id, | 157 | id, |
157 | name: service.name, | 158 | name: service.name, |
158 | ...newSettings, | 159 | ...newSettings, |
159 | iconUrl: `http://${hostname}:${port}/v1/icon/${ | 160 | iconUrl: `http://${hostname}:${port}/${API_VERSION}/icon/${ |
160 | newSettings.iconId | 161 | newSettings.iconId |
161 | }`, | 162 | }`, |
162 | userId: 1, | 163 | userId: 1, |
@@ -196,7 +197,7 @@ class ServiceController { | |||
196 | id, | 197 | id, |
197 | name: service.name, | 198 | name: service.name, |
198 | ...settings, | 199 | ...settings, |
199 | iconUrl: `${Env.get('APP_URL')}/v1/icon/${settings.iconId}`, | 200 | iconUrl: `${Env.get('APP_URL')}/${API_VERSION}/icon/${settings.iconId}`, |
200 | userId: 1, | 201 | userId: 1, |
201 | }, | 202 | }, |
202 | status: ['updated'], | 203 | status: ['updated'], |
@@ -262,7 +263,7 @@ class ServiceController { | |||
262 | workspaces: [], | 263 | workspaces: [], |
263 | ...JSON.parse(service.settings), | 264 | ...JSON.parse(service.settings), |
264 | iconUrl: settings.iconId | 265 | iconUrl: settings.iconId |
265 | ? `http://${hostname}:${port}/v1/icon/${settings.iconId}` | 266 | ? `http://${hostname}:${port}/${API_VERSION}/icon/${settings.iconId}` |
266 | : null, | 267 | : null, |
267 | id: service.serviceId, | 268 | id: service.serviceId, |
268 | name: service.name, | 269 | name: service.name, |