From e6e5ec8a5fe9086b61469093324804a9ef1d9836 Mon Sep 17 00:00:00 2001 From: Karan Bedi Date: Mon, 11 May 2020 16:25:47 +0530 Subject: [PATCH] Make notification service username a config setting --- app/api/server/v1/chat.js | 2 +- app/lib/server/startup/settings.js | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/api/server/v1/chat.js b/app/api/server/v1/chat.js index b095228a1b88..9df879ba252f 100644 --- a/app/api/server/v1/chat.js +++ b/app/api/server/v1/chat.js @@ -127,7 +127,7 @@ API.v1.addRoute('chat.postMessage', { authRequired: true }, { post() { // WIDECHAT only let messageReturn; - if (this.user.username === 'viasat.notification.service') { + if (this.user.username === settings.get('Notification_Service_User_Username')) { const { hostname_id } = this.requestParams(); if (!hostname_id) { throw new Meteor.Error('error-hostname-id-not-provided', 'Body param "hostname_id" is required'); diff --git a/app/lib/server/startup/settings.js b/app/lib/server/startup/settings.js index 44ef6f1c88eb..6fb24e8e2c58 100644 --- a/app/lib/server/startup/settings.js +++ b/app/lib/server/startup/settings.js @@ -925,6 +925,9 @@ settings.addGroup('General', function() { public: true, i18nDescription: 'Notifications_Always_Notify_Mobile_Description', }); + this.add('Notification_Service_User_Username', 'viasat.notification.service', { + type: 'string', + }); }); this.section('REST API', function() { return this.add('API_User_Limit', 500, {