aboutsummaryrefslogtreecommitdiff
path: root/vnext/server
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2022-10-29 23:54:47 +0300
committerGravatar Vitaly Takmazov2023-01-13 10:37:58 +0300
commit3df035b7ddc002bf5c758419a33f5c2f369716bd (patch)
tree37a6af6c9fdf4887b15181de4256fa646fae5223 /vnext/server
parent47218df561e877265c739ffab59b760318ea3143 (diff)
Use config settings
Diffstat (limited to 'vnext/server')
-rw-r--r--vnext/server/sender.js18
1 files changed, 12 insertions, 6 deletions
diff --git a/vnext/server/sender.js b/vnext/server/sender.js
index 6d88c4c0..6ece8eaa 100644
--- a/vnext/server/sender.js
+++ b/vnext/server/sender.js
@@ -2,34 +2,40 @@ import PushNotifications from 'node-pushnotifications';
var debug = require('debug')('sender');
import { deleteSubscribers } from './http';
import { formatMessage, formatTitle, formatQuote } from './common/MessageUtils';
+import config from 'config';
+
+let cfg = /** @type { import('node-pushnotifications').Settings } */ (config);
const apnConfig = (production = true) => {
const apn = {
+ ...cfg.apn,
token: {
- key: process.env.JUICK_APN_KEY,
- keyId: process.env.JUICK_APN_KEY_ID,
- teamId: process.env.JUICK_APN_TEAM_ID
+ key: cfg.apn?.token?.key || process.env.JUICK_APN_KEY,
+ keyId: cfg.apn?.token?.keyId || process.env.JUICK_APN_KEY_ID,
+ teamId: cfg.apn?.token?.teamId || process.env.JUICK_APN_TEAM_ID
},
production: production
};
return apn;
};
const gcmConfig = {
- id: process.env.JUICK_GCM_ID
+ ...cfg.gcm,
+ id: cfg.gcm?.id || process.env.JUICK_GCM_ID
};
const push = new PushNotifications({
+ ...config,
apn: apnConfig(true),
gcm: gcmConfig,
});
const sandbox = new PushNotifications({
+ ...config,
apn: apnConfig(false),
gcm: gcmConfig
});
/** @type {string} */
-const application = process.env.JUICK_APN_APPLICATION || '';
-
+const application = config.get('service.application') || process.env.JUICK_APN_APPLICATION || '';
/**
* send notification