aboutsummaryrefslogtreecommitdiffstats
path: root/src/internal-server/app
diff options
context:
space:
mode:
authorLibravatar Vijay A <avijayr@protonmail.com>2021-08-05 15:03:07 +0530
committerLibravatar Vijay Raghavan Aravamudhan <vraravam@users.noreply.github.com>2021-08-05 12:56:30 +0000
commitc1aa23aca9ac88125b34e24f155c577ef5fad39c (patch)
tree7217fe47b4b9335ec766459431d989e487cd964b /src/internal-server/app
parentrevert: partially reverts the previous change to fix issue that the packaged ... (diff)
downloadferdium-app-c1aa23aca9ac88125b34e24f155c577ef5fad39c.tar.gz
ferdium-app-c1aa23aca9ac88125b34e24f155c577ef5fad39c.tar.zst
ferdium-app-c1aa23aca9ac88125b34e24f155c577ef5fad39c.zip
fix: change all occurrences of hard-coded ip address '127.0.0.1' to 'localhost'
Also refactored to make this a constant defined in a single file where it is imported for all other uses. fixes #1253
Diffstat (limited to 'src/internal-server/app')
-rw-r--r--src/internal-server/app/Controllers/Http/ServiceController.js10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/internal-server/app/Controllers/Http/ServiceController.js b/src/internal-server/app/Controllers/Http/ServiceController.js
index c30e9e040..e4a7f0295 100644
--- a/src/internal-server/app/Controllers/Http/ServiceController.js
+++ b/src/internal-server/app/Controllers/Http/ServiceController.js
@@ -5,6 +5,10 @@ const Env = use('Env');
5const uuid = require('uuid/v4'); 5const uuid = require('uuid/v4');
6const path = require('path'); 6const path = require('path');
7const fs = require('fs-extra'); 7const fs = require('fs-extra');
8const { LOCAL_HOSTNAME } = require('../../../../config');
9
10const hostname = LOCAL_HOSTNAME;
11const port = Env.get('PORT');
8 12
9class ServiceController { 13class ServiceController {
10 // Create a new service for user 14 // Create a new service for user
@@ -84,7 +88,7 @@ class ServiceController {
84 workspaces: [], 88 workspaces: [],
85 ...JSON.parse(service.settings), 89 ...JSON.parse(service.settings),
86 iconUrl: settings.iconId 90 iconUrl: settings.iconId
87 ? `http://127.0.0.1:${Env.get('PORT')}/v1/icon/${settings.iconId}` 91 ? `http://${hostname}:${port}/v1/icon/${settings.iconId}`
88 : null, 92 : null,
89 id: service.serviceId, 93 id: service.serviceId,
90 name: service.name, 94 name: service.name,
@@ -152,7 +156,7 @@ class ServiceController {
152 id, 156 id,
153 name: service.name, 157 name: service.name,
154 ...newSettings, 158 ...newSettings,
155 iconUrl: `http://127.0.0.1:${Env.get('PORT')}/v1/icon/${ 159 iconUrl: `http://${hostname}:${port}/v1/icon/${
156 newSettings.iconId 160 newSettings.iconId
157 }`, 161 }`,
158 userId: 1, 162 userId: 1,
@@ -258,7 +262,7 @@ class ServiceController {
258 workspaces: [], 262 workspaces: [],
259 ...JSON.parse(service.settings), 263 ...JSON.parse(service.settings),
260 iconUrl: settings.iconId 264 iconUrl: settings.iconId
261 ? `http://127.0.0.1:${Env.get('PORT')}/v1/icon/${settings.iconId}` 265 ? `http://${hostname}:${port}/v1/icon/${settings.iconId}`
262 : null, 266 : null,
263 id: service.serviceId, 267 id: service.serviceId,
264 name: service.name, 268 name: service.name,