@tiledesk/tiledesk-server 2.3.75 → 2.3.77

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -33,9 +33,26 @@ const maskOptions = {
33
33
  unmaskedEndDigits : 3 // Should be positive Integer
34
34
  };
35
35
 
36
+ var alg = process.env.GLOBAL_SECRET_ALGORITHM;
37
+ winston.info('Authentication Global Algorithm : ' + alg);
36
38
 
37
- var configSecret = process.env.GLOBAL_SECRET_OR_PUB_KEY || process.env.GLOBAL_SECRET || config.secret;
39
+ // TODO STAMPA ANCHE PUBLIC
38
40
 
41
+ var configSecret = process.env.GLOBAL_SECRET || config.secret;
42
+
43
+ var pKey = process.env.GLOBAL_SECRET_OR_PUB_KEY;
44
+ // console.log("pKey",pKey);
45
+
46
+ if (pKey) {
47
+ configSecret = pKey.replace(/\\n/g, '\n');
48
+ }
49
+ // console.log("configSecret",configSecret);
50
+ // if (process.env.GLOBAL_SECRET_OR_PUB_KEY) {
51
+ // console.log("GLOBAL_SECRET_OR_PUB_KEY defined");
52
+
53
+ // }else {
54
+ // console.log("GLOBAL_SECRET_OR_PUB_KEY undefined");
55
+ // }
39
56
 
40
57
  var maskedconfigSecret = MaskData.maskPhone(configSecret, maskOptions);
41
58
  winston.info('Authentication Global Secret : ' + maskedconfigSecret);
package/models/faq_kb.js CHANGED
@@ -3,6 +3,9 @@ var Schema = mongoose.Schema;
3
3
  const uuidv4 = require('uuid/v4');
4
4
  var winston = require('../config/winston');
5
5
 
6
+ var defaultFullTextLanguage = process.env.DEFAULT_FULLTEXT_INDEX_LANGUAGE || "none";
7
+
8
+
6
9
  var Faq_kbSchema = new Schema({
7
10
  name: {
8
11
  type: String,
@@ -84,7 +87,10 @@ var Faq_kbSchema = new Schema({
84
87
  type: String,
85
88
  required: false,
86
89
  default: 'none'
87
- }
90
+ },
91
+ tags: [{
92
+ type: String
93
+ }]
88
94
  },{
89
95
  timestamps: true
90
96
  }
@@ -98,6 +104,8 @@ Faq_kbSchema.virtual('fullName').get(function () {
98
104
  Faq_kbSchema.index({certified: 1, public: 1}); //suggested by atlas
99
105
 
100
106
 
107
+ Faq_kbSchema.index({name: 'text', description: 'text', subject: 'text', "tags": 'text'},
108
+ {"name":"faqkb_fulltext","default_language": defaultFullTextLanguage,"language_override": "language"}); // schema level
101
109
 
102
110
 
103
111
  var faq_kb = mongoose.model('faq_kb', Faq_kbSchema);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tiledesk/tiledesk-server",
3
3
  "description": "The Tiledesk server module",
4
- "version": "2.3.75",
4
+ "version": "2.3.77",
5
5
  "scripts": {
6
6
  "start": "node ./bin/www",
7
7
  "pretest": "mongodb-runner start",
@@ -37,14 +37,15 @@
37
37
  },
38
38
  "dependencies": {
39
39
  "@tiledesk/tiledesk-apps": "^1.0.12",
40
- "@tiledesk/tiledesk-whatsapp-connector": "^0.1.19",
41
- "@tiledesk/tiledesk-kaleyra-proxy": "^0.1.6",
42
40
  "@tiledesk/tiledesk-chat21-app": "^1.1.7",
43
41
  "@tiledesk/tiledesk-chatbot-util": "^0.8.33",
42
+ "@tiledesk/tiledesk-dialogflow-connector": "^1.8.3",
44
43
  "@tiledesk/tiledesk-json-rules-engine": "^4.0.3",
44
+ "@tiledesk/tiledesk-kaleyra-proxy": "^0.1.6",
45
45
  "@tiledesk/tiledesk-rasa-connector": "^1.0.10",
46
- "@tiledesk/tiledesk-tybot-connector": "^0.1.51",
47
- "@tiledesk/tiledesk-dialogflow-connector": "^1.8.3",
46
+ "@tiledesk/tiledesk-tybot-connector": "^0.1.55",
47
+ "@tiledesk/tiledesk-whatsapp-connector": "^0.1.24",
48
+ "amqplib": "^0.5.5",
48
49
  "app-root-path": "^3.0.0",
49
50
  "bcrypt-nodejs": "0.0.3",
50
51
  "body-parser": "^1.20.0",
@@ -54,7 +55,6 @@
54
55
  "csv-express": "^1.2.2",
55
56
  "debug": "^4.3.4",
56
57
  "dotenv": "^8.6.0",
57
- "amqplib": "^0.5.5",
58
58
  "email-templates": "^8.1.0",
59
59
  "eventemitter2": "^6.4.4",
60
60
  "express": "^4.17.3",
@@ -64,6 +64,7 @@
64
64
  "fast-csv": "^4.3.6",
65
65
  "geoip-lite": "^1.4.5",
66
66
  "handlebars": "^4.7.7",
67
+ "handlebars-dateformat": "^1.1.3",
67
68
  "html-entities": "^2.3.3",
68
69
  "http": "0.0.0",
69
70
  "immutable": "^4.1.0",
@@ -423,7 +423,15 @@
423
423
  winston.debug("Deleted cache for faq_kb.update secret",reply);
424
424
  winston.verbose("Deleted cache for faq_kb.update secret",{err:err});
425
425
  });
426
-
426
+
427
+ // without project for tilebot
428
+ key = "faq_kbs:id:"+faq_kb._id;
429
+ winston.verbose("Deleting cache for faq_kb.update without project for tilebot with key: " + key);
430
+ client.del(key, function (err, reply) {
431
+ winston.debug("Deleted cache for faq_kb.update without project for tilebot ",reply);
432
+ winston.verbose("Deleted cache for faq_kb.update without project for tilebot ",{err:err});
433
+ });
434
+
427
435
  // TODO invalidate widgets here
428
436
  winston.verbose("Deleting widgets cache for faqbot.update");
429
437
  invalidateWidgets(client, faq_kb.id_project); //TESTED
@@ -446,6 +454,15 @@
446
454
  client.del(key, function (err, reply) {
447
455
  winston.debug("Deleted cache for faq_kb.delete secret",reply);
448
456
  winston.verbose("Deleted cache for faq_kb.delete secret",{err:err});
457
+ });
458
+
459
+
460
+ // without project for tilebot
461
+ key = "faq_kbs:id:"+faq_kb._id;
462
+ winston.verbose("Deleting cache for faq_kb.update without project for tilebot with key: " + key);
463
+ client.del(key, function (err, reply) {
464
+ winston.debug("Deleted cache for faq_kb.update without project for tilebot ",reply);
465
+ winston.verbose("Deleted cache for faq_kb.update without project for tilebot ",{err:err});
449
466
  });
450
467
 
451
468
  // TODO invalidate widgets here
@@ -50,6 +50,7 @@ class Listener {
50
50
  if (err) {
51
51
  return winston.error('error saving faqkb dialogflow ', err)
52
52
  }
53
+ botEvent.emit("faqbot.update",savedFaq_kb); //cache invalidation
53
54
  winston.verbose('Saved faqkb dialogflow', savedFaq_kb.toObject())
54
55
  });
55
56
  }
@@ -24,7 +24,16 @@ var configGlobal = require('../../config/global');
24
24
 
25
25
  var widgetConfig = require('../../config/widget');
26
26
  var widgetTestLocation = process.env.WIDGET_TEST_LOCATION || widgetConfig.testLocation;
27
- let configSecret = process.env.GLOBAL_SECRET_OR_PRIVATE_KEY || process.env.GLOBAL_SECRET || config.secret;
27
+
28
+
29
+ let configSecret = process.env.GLOBAL_SECRET || config.secret;
30
+
31
+ var pKey = process.env.GLOBAL_SECRET_OR_PRIVATE_KEY;
32
+ // console.log("pKey",pKey);
33
+
34
+ if (pKey) {
35
+ configSecret = pKey.replace(/\\n/g, '\n');
36
+ }
28
37
 
29
38
  let apiUrl = process.env.API_URL || configGlobal.apiUrl;
30
39
  winston.debug('********* RequestNotification apiUrl: ' + apiUrl);
@@ -13,17 +13,21 @@ class Listener {
13
13
  winston.debug("kaleyra config databaseUri: " + config.databaseUri);
14
14
  }
15
15
 
16
- kaleyra.startApp({
17
- MONGODB_URL: config.databaseUri,
18
- API_URL: apiUrl,
19
- BASE_URL: apiUrl + "/modules/kaleyra",
20
- APPS_API_URL: apiUrl + "/modules/apps",
21
- KALEYRA_API_URL: process.env.KALEYRA_API_URL,
22
- API_KEY: process.env.API_KEY,
23
- log: process.env.KALEYRA_LOG
24
- }, () => {
25
- winston.info("Tiledesk Kaleyra proxy server succesfully started.");
26
- })
16
+ if (!process.env.KALEYRA_API_URL || !process.env.API_KEY) {
17
+ winston.info("Skip Kaleyra startApp")
18
+ } else {
19
+ kaleyra.startApp({
20
+ MONGODB_URL: config.databaseUri,
21
+ API_URL: apiUrl,
22
+ BASE_URL: apiUrl + "/modules/kaleyra",
23
+ APPS_API_URL: apiUrl + "/modules/apps",
24
+ KALEYRA_API_URL: process.env.KALEYRA_API_URL,
25
+ API_KEY: process.env.API_KEY,
26
+ log: process.env.KALEYRA_LOG
27
+ }, () => {
28
+ winston.info("Tiledesk Kaleyra proxy server succesfully started.");
29
+ })
30
+ }
27
31
  }
28
32
  }
29
33
 
@@ -56,6 +56,7 @@ class Listener {
56
56
  if (err) {
57
57
  return winston.error('error saving faqkb rasa ', err)
58
58
  }
59
+ botEvent.emit("faqbot.update",savedFaq_kb); //cache invalidation
59
60
  winston.verbose('Saved faqkb rasa', savedFaq_kb.toObject())
60
61
  });
61
62
  }
@@ -69,6 +69,7 @@ class Listener {
69
69
  if (err) {
70
70
  return winston.error('error saving faqkb tilebot ', err)
71
71
  }
72
+ botEvent.emit("faqbot.update",savedFaq_kb); //cache invalidation
72
73
  winston.verbose('Saved faqkb tilebot', savedFaq_kb.toObject())
73
74
  });
74
75
  }
@@ -13,16 +13,20 @@ class Listener {
13
13
  winston.debug("whatsapp config databaseUri: " + config.databaseUri);
14
14
  }
15
15
 
16
- whatsapp.startApp({
17
- MONGODB_URL: config.databaseUri,
18
- API_URL: apiUrl,
19
- GRAPH_URL: process.env.META_GRAPH_URL || config.graphUrl,
20
- BASE_URL: apiUrl + "/modules/whatsapp",
21
- APPS_API_URL: apiUrl + "/modules/apps",
22
- log: process.env.WHATSAPP_LOG
23
- }, () => {
24
- winston.info("Tiledesk WhatsApp Connector proxy server succesfully started.");
25
- })
16
+ if (!process.env.GRAPH_URL || !config.graphUrl) {
17
+ winston.info("Skip WhatsApp startApp")
18
+ } else {
19
+ whatsapp.startApp({
20
+ MONGODB_URL: config.databaseUri,
21
+ API_URL: apiUrl,
22
+ GRAPH_URL: process.env.META_GRAPH_URL || config.graphUrl,
23
+ BASE_URL: apiUrl + "/modules/whatsapp",
24
+ APPS_API_URL: apiUrl + "/modules/apps",
25
+ log: process.env.WHATSAPP_LOG
26
+ }, () => {
27
+ winston.info("Tiledesk WhatsApp Connector proxy server succesfully started.");
28
+ })
29
+ }
26
30
 
27
31
  }
28
32
  }
package/routes/auth.js CHANGED
@@ -24,7 +24,15 @@ var validtoken = require('../middleware/valid-token');
24
24
  var PendingInvitation = require("../models/pending-invitation");
25
25
  const { check, validationResult } = require('express-validator');
26
26
  var UserUtil = require('../utils/userUtil');
27
- let configSecret = process.env.GLOBAL_SECRET_OR_PRIVATE_KEY || process.env.GLOBAL_SECRET || config.secret;
27
+
28
+ let configSecret = process.env.GLOBAL_SECRET || config.secret;
29
+ var pKey = process.env.GLOBAL_SECRET_OR_PRIVATE_KEY;
30
+ // console.log("pKey",pKey);
31
+
32
+ if (pKey) {
33
+ configSecret = pKey.replace(/\\n/g, '\n');
34
+ }
35
+
28
36
  // const fs = require('fs');
29
37
  // var configSecret = fs.readFileSync('private.key');
30
38
 
@@ -540,7 +548,7 @@ router.put('/requestresetpsw', function (req, res) {
540
548
  emailService.sendPasswordResetRequestEmail(updatedUser.email, updatedUser.resetpswrequestid, updatedUser.firstname, updatedUser.lastname);
541
549
 
542
550
 
543
-
551
+ // TODO emit user.update?
544
552
  authEvent.emit('user.requestresetpassword', {updatedUser:updatedUser, req:req});
545
553
 
546
554
 
@@ -598,7 +606,7 @@ router.put('/resetpsw/:resetpswrequestid', function (req, res) {
598
606
 
599
607
  emailService.sendYourPswHasBeenChangedEmail(saveUser.email, saveUser.firstname, saveUser.lastname);
600
608
 
601
-
609
+ // TODO emit user.update?
602
610
  authEvent.emit('user.resetpassword', {saveUser:saveUser, req:req});
603
611
 
604
612
 
package/routes/faq_kb.js CHANGED
@@ -12,6 +12,7 @@ const { forEach } = require('lodash');
12
12
  var multer = require('multer')
13
13
  var upload = multer()
14
14
  var configGlobal = require('../config/global');
15
+ const faq = require('../models/faq');
15
16
 
16
17
  let chatbot_templates_api_url = process.env.CHATBOT_TEMPLATES_API_URL
17
18
 
@@ -250,6 +251,10 @@ router.put('/:faq_kbid', function (req, res) {
250
251
  update.intentsEngine = req.body.intentsEngine;
251
252
  }
252
253
 
254
+ if (req.body.tags != undefined) {
255
+ update.tags = req.body.tags;
256
+ }
257
+
253
258
  Faq_kb.findByIdAndUpdate(req.params.faq_kbid, update, { new: true, upsert: true }, function (err, updatedFaq_kb) {
254
259
  if (err) {
255
260
  return res.status(500).send({ success: false, msg: 'Error updating object.' });
@@ -387,12 +392,23 @@ router.get('/', function (req, res) {
387
392
  query.type = { $ne: "identity" }
388
393
  }
389
394
 
390
- winston.debug("query", query);
395
+ var search_obj = {"$search": req.query.text};
396
+
397
+ if (req.query.text) {
398
+ if (req.query.language) {
399
+ search_obj["$language"] = req.query.language;
400
+ }
401
+ query.$text = search_obj;
402
+ }
403
+
404
+
405
+
406
+ winston.info("query", query);
391
407
 
392
408
  Faq_kb.find(query, function (err, faq_kb) {
393
409
  if (err) {
394
410
  winston.error('GET FAQ-KB ERROR ', err)
395
- return (err);
411
+ return res.status(500).send({ success: false, message: "Unable to get chatbots" });
396
412
  }
397
413
 
398
414
  res.json(faq_kb);
@@ -475,6 +491,7 @@ router.post('/importjson/:id_faq_kb', upload.single('uploadFile'), (req, res) =>
475
491
  id_project: req.projectid,
476
492
  createdBy: req.user.id,
477
493
  intent_display_name: intent.intent_display_name,
494
+ intent_id: intent.intent_id,
478
495
  question: intent.question,
479
496
  answer: intent.answer,
480
497
  reply: intent.reply,
@@ -524,7 +541,7 @@ router.post('/importjson/:id_faq_kb', upload.single('uploadFile'), (req, res) =>
524
541
  } else {
525
542
 
526
543
  if (req.query.create && req.query.create == 'true') {
527
- faqService.create(json.name, undefined, req.projectid, req.user.id, "tilebot", json.description, json.webhook_url, json.webhook_enabled, json.language, undefined, undefined, undefined).then((savedFaq_kb) => {
544
+ faqService.create(json.name, undefined, req.projectid, req.user.id, "tilebot", json.description, json.webhook_url, json.webhook_enabled, json.language, undefined, undefined, undefined, json.attributes).then((savedFaq_kb) => {
528
545
  winston.debug("saved (and imported) faq kb: ", savedFaq_kb);
529
546
  botEvent.emit('faqbot.create', savedFaq_kb);
530
547
 
@@ -535,6 +552,7 @@ router.post('/importjson/:id_faq_kb', upload.single('uploadFile'), (req, res) =>
535
552
  id_project: req.projectid,
536
553
  createdBy: req.user.id,
537
554
  intent_display_name: intent.intent_display_name,
555
+ intent_id: intent.intent_id,
538
556
  question: intent.question,
539
557
  answer: intent.answer,
540
558
  reply: intent.reply,
@@ -617,6 +635,9 @@ router.post('/importjson/:id_faq_kb', upload.single('uploadFile'), (req, res) =>
617
635
  if (json.description) {
618
636
  faq_kb.description = json.description;
619
637
  }
638
+ if (json.attributes) {
639
+ faq_kb.attributes = json.attributes;
640
+ }
620
641
 
621
642
  Faq_kb.findByIdAndUpdate(id_faq_kb, faq_kb, { new: true }, (err, updatedFaq_kb) => {
622
643
  if (err) {
@@ -632,6 +653,7 @@ router.post('/importjson/:id_faq_kb', upload.single('uploadFile'), (req, res) =>
632
653
  id_project: req.projectid,
633
654
  createdBy: req.user.id,
634
655
  intent_display_name: intent.intent_display_name,
656
+ intent_id: intent.intent_id,
635
657
  question: intent.question,
636
658
  answer: intent.answer,
637
659
  reply: intent.reply,
@@ -687,7 +709,6 @@ router.post('/importjson/:id_faq_kb', upload.single('uploadFile'), (req, res) =>
687
709
  }
688
710
 
689
711
  }
690
-
691
712
  })
692
713
 
693
714
  router.get('/exportjson/:id_faq_kb', (req, res) => {
@@ -704,10 +725,10 @@ router.get('/exportjson/:id_faq_kb', (req, res) => {
704
725
  } else {
705
726
  winston.debug('FAQ-KB: ', faq_kb)
706
727
 
707
-
708
728
  faqService.getAll(id_faq_kb).then((faqs) => {
709
729
 
710
- const intents = faqs.map(({ _id, id_project, topic, status, id_faq_kb, createdBy, intent_id, createdAt, updatedAt, __v, ...keepAttrs }) => keepAttrs)
730
+ // delete from exclude map intent_id
731
+ const intents = faqs.map(({ _id, id_project, topic, status, id_faq_kb, createdBy, createdAt, updatedAt, __v, ...keepAttrs }) => keepAttrs)
711
732
 
712
733
  let json = {
713
734
  webhook_enabled: faq_kb.webhook_enabled,
@@ -715,6 +736,7 @@ router.get('/exportjson/:id_faq_kb', (req, res) => {
715
736
  language: faq_kb.language,
716
737
  name: faq_kb.name,
717
738
  description: faq_kb.description,
739
+ attributes: faq_kb.attributes,
718
740
  intents: intents
719
741
  }
720
742
 
package/routes/images.js CHANGED
@@ -192,11 +192,11 @@ uploadAvatar.single('file'), (req, res, next) => {
192
192
 
193
193
 
194
194
  var destinationFolder = 'uploads/users/' + userid + "/images/";
195
- winston.info("destinationFolder:"+destinationFolder);
195
+ winston.debug("destinationFolder:"+destinationFolder);
196
196
 
197
197
  var thumFilename = destinationFolder+'thumbnails_200_200-photo.jpg';
198
198
 
199
- winston.info("req.file.filename:"+req.file.filename);
199
+ winston.debug("req.file.filename:"+req.file.filename);
200
200
  fileService.getFileDataAsBuffer(req.file.filename).then(function(buffer) {
201
201
 
202
202
  sharp(buffer).resize(200, 200).toBuffer((err, resizeImage, info) => {
@@ -8,7 +8,7 @@ const ActionsConstants = require('../models/actionsConstants');
8
8
  class FaqService {
9
9
 
10
10
 
11
- create(name, url, projectid, user_id, type, description, webhook_url, webhook_enabled, language, template, mainCategory, intentsEngine) {
11
+ create(name, url, projectid, user_id, type, description, webhook_url, webhook_enabled, language, template, mainCategory, intentsEngine, attributes) {
12
12
  var that = this;
13
13
  return new Promise(function (resolve, reject) {
14
14
 
@@ -28,7 +28,8 @@ class FaqService {
28
28
  intentsEngine: intentsEngine,
29
29
  trashed: false,
30
30
  createdBy: user_id,
31
- updatedBy: user_id
31
+ updatedBy: user_id,
32
+ attributes: attributes
32
33
  });
33
34
 
34
35
 
@@ -101,9 +102,55 @@ class FaqService {
101
102
 
102
103
  if (template==="blank") {
103
104
 
105
+ // faqsArray = [
106
+ // { 'question': '\\start', 'answer': 'Hello', 'intent_display_name': 'start', 'topic': 'internal' },
107
+ // { 'question': 'defaultFallback', 'answer': 'I can not provide an adequate answer. Write a new question or talk to a human agent.\n* Back to start tdAction:start\n* See the docs https://docs.tiledesk.com/\n* 👨🏻‍🦰 I want an agent', 'intent_display_name': 'defaultFallback', 'topic': 'internal' }, //TODO se metto spazio n * nn va
108
+ // ]
104
109
  faqsArray = [
105
- { 'question': '\\start', 'answer': 'Hello', 'intent_display_name': 'start', 'topic': 'internal' },
106
- { 'question': 'defaultFallback', 'answer': 'I can not provide an adequate answer. Write a new question or talk to a human agent.\n* Back to start tdAction:start\n* See the docs https://docs.tiledesk.com/\n* 👨🏻‍🦰 I want an agent', 'intent_display_name': 'defaultFallback', 'topic': 'internal' }, //TODO se metto spazio n * nn va
110
+ {
111
+ 'question': '\\start',
112
+ "actions" : [
113
+ {
114
+ "_tdActionType" : "reply",
115
+ "text" : "Hi, how can I help you?",
116
+ "attributes" : {
117
+ "commands" : [
118
+ {
119
+ "type" : "message",
120
+ "message" : {
121
+ "type" : "text",
122
+ "text" : "Hi, how can I help you?"
123
+ }
124
+ }
125
+ ]
126
+ }
127
+ }
128
+ ],
129
+ 'intent_display_name': 'start',
130
+ 'topic': 'internal'
131
+ },
132
+ {
133
+ 'question': 'defaultFallback',
134
+ "actions" : [
135
+ {
136
+ "_tdActionType" : "reply",
137
+ "text" : "I didn't understand. Can you rephrase your question?",
138
+ "attributes" : {
139
+ "commands" : [
140
+ {
141
+ "type" : "message",
142
+ "message" : {
143
+ "type" : "text",
144
+ "text" : "I didn't understand. Can you rephrase your question?"
145
+ }
146
+ }
147
+ ]
148
+ }
149
+ }
150
+ ],
151
+ 'intent_display_name': 'defaultFallback',
152
+ 'topic': 'internal'
153
+ }, //TODO se metto spazio n * nn va
107
154
  ]
108
155
 
109
156
  }
@@ -130,6 +177,7 @@ class FaqService {
130
177
  id_faq_kb: faq_kb_id,
131
178
  question: faq.question,
132
179
  answer: faq.answer,
180
+ actions: faq.actions,
133
181
  reply: faq.reply,
134
182
  intent_display_name: faq.intent_display_name,
135
183
  language: "en",
@@ -92,7 +92,15 @@ class SubscriptionNotifier {
92
92
  signOptions.algorithm = alg;
93
93
  }
94
94
 
95
- secret = process.env.GLOBAL_SECRET_OR_PRIVATE_KEY || process.env.GLOBAL_SECRET || config.secret;
95
+ secret = process.env.GLOBAL_SECRET || config.secret;
96
+ var pKey = process.env.GLOBAL_SECRET_OR_PRIVATE_KEY;
97
+ // console.log("pKey",pKey);
98
+
99
+ if (pKey) {
100
+ secret = pKey.replace(/\\n/g, '\n');
101
+ }
102
+
103
+
96
104
  }
97
105
 
98
106
  var token = jwt.sign(sJson, secret, signOptions); //priv_jwt pp_jwt
@@ -22,7 +22,16 @@ var cacheUtil = require('../utils/cacheUtil');
22
22
  var mongoose = require('mongoose');
23
23
  const requestConstants = require("../models/requestConstants");
24
24
  var RoleConstants = require('../models/roleConstants');
25
- let configSecretOrPubicKay = process.env.GLOBAL_SECRET_OR_PUB_KEY || process.env.GLOBAL_SECRET || config.secret;
25
+
26
+ let configSecretOrPubicKay = process.env.GLOBAL_SECRET || config.secret;
27
+
28
+ var pKey = process.env.GLOBAL_SECRET_OR_PUB_KEY;
29
+ // console.log("pKey",pKey);
30
+
31
+ if (pKey) {
32
+ configSecretOrPubicKay = pKey.replace(/\\n/g, '\n');
33
+ }
34
+
26
35
  var cacheEnabler = require("../services/cacheEnabler");
27
36
 
28
37
 
@@ -92,7 +101,7 @@ class WebSocketServer {
92
101
  // winston.debug('hasRoleAsPromise project_user',project_user);
93
102
  // winston.debug('ok websocket');
94
103
 
95
- User.findOne({_id: identifier, status: 100}, 'email firstname lastname emailverified id')
104
+ User.findOne({_id: identifier, status: 100}, 'email firstname lastname emailverified id') //TODO user_cache_here ma attento select.. ATTENTO SERVER SELECT??
96
105
  //@DISABLED_CACHE .cache(cacheUtil.defaultTTL, "users:id:"+identifier) //user_cache
97
106
  .exec(function (err, user) {
98
107