Skip to content

Commit

Permalink
[OGUI-1426] && [OGUI-1427] Improve resilience of ILG (#2146)
Browse files Browse the repository at this point in the history
* Adds default value for instance name on both client and server sides.
* removes the `port` and `host` information from `status` API request
* removes open access to `frameworkInfo`
  • Loading branch information
graduta authored Oct 5, 2023
1 parent da54ba9 commit 42fcdfd
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions InfoLogger/lib/StatusService.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class StatusService {
result.version = this.projPackage.version;
}
if (this.config.http) {
const ilg = {hostname: this.config.http.hostname, port: this.config.http.port, status: {ok: true}};
const ilg = {status: {ok: true}};
result = Object.assign(result, ilg);
}
res.status(200).json(result);
Expand Down Expand Up @@ -95,7 +95,7 @@ class StatusService {
}
if (this.config.http) {
const {http} = this.config;
const ilg = {hostname: http.hostname, port: http.port, status: {ok: true}, name: http.name };
const ilg = {hostname: http.hostname, port: http.port, status: {ok: true}, name: http.name ?? '' };
info = Object.assign(info, ilg);
}
return info;
Expand Down
2 changes: 1 addition & 1 deletion InfoLogger/lib/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ module.exports.attachTo = async (http, ws) => {
http.get('/query/stats', queryController.getQueryStats.bind(queryController), {public: true});

http.get('/status/gui', statusService.getILGStatus.bind(statusService), {public: true});
http.get('/getFrameworkInfo', statusService.frameworkInfo.bind(statusService), {public: true});
http.get('/getFrameworkInfo', statusService.frameworkInfo.bind(statusService));

http.get('/getUserProfile', (req, res) => profileService.getUserProfile(req, res));
http.get('/getProfile', (req, res) => profileService.getProfile(req, res));
Expand Down
1 change: 1 addition & 0 deletions InfoLogger/public/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@ mount(document.body, view, model, debug);

// Expose model to interact with it the browser's console
window.model = model;
window.ILG = {name: 'ILG - '};
2 changes: 1 addition & 1 deletion InfoLogger/test/lib/mocha-status-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ describe('Status Service test suite', () => {
}
await statusService.getILGStatus(undefined, res);

const info = {hostname: 'localhost', port: 8080, status: {ok: true}};
const info = {status: {ok: true}};

assert.ok(res.status.calledWith(200));
assert.ok(res.json.calledWith(info));
Expand Down

0 comments on commit 42fcdfd

Please sign in to comment.