cloudcms-server 4.0.0-beta.2 → 4.0.0-beta.20

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.
Files changed (78) hide show
  1. package/README.md +0 -5
  2. package/cloudcms-server.iml +1 -0
  3. package/index.js +58 -32
  4. package/middleware/authentication/authentication.js +40 -12
  5. package/middleware/authentication/providers/saml.js +8 -4
  6. package/middleware/awareness/awareness.js +8 -7
  7. package/middleware/awareness/plugins/api_event.js +105 -0
  8. package/middleware/awareness/plugins/editorial.js +54 -3
  9. package/middleware/awareness/plugins/resources.js +13 -5
  10. package/middleware/config/adapter.js +0 -44
  11. package/middleware/deployment/deployment.js +22 -24
  12. package/middleware/driver/driver.js +24 -1
  13. package/middleware/driver-config/driver-config.js +0 -6
  14. package/middleware/modules/modules.js +11 -5
  15. package/middleware/perf/perf.js +3 -2
  16. package/middleware/registration/registration.js +0 -5
  17. package/middleware/stores/engines/empty.js +0 -4
  18. package/middleware/stores/engines/fs-caching-adapter.js +0 -5
  19. package/middleware/stores/engines/fs.js +0 -9
  20. package/middleware/stores/engines/s3.js +0 -5
  21. package/middleware/stores/engines/s3fs.js +0 -5
  22. package/middleware/stores/multistore.js +0 -29
  23. package/middleware/stores/store.js +0 -10
  24. package/middleware/stores/stores.js +2 -2
  25. package/middleware/virtual-config/virtual-config.js +253 -206
  26. package/middleware/virtual-files/virtual-files.js +0 -3
  27. package/middleware/welcome/welcome.js +0 -3
  28. package/notifications/notifications.js +72 -10
  29. package/notifications/providers/kafka.js +182 -0
  30. package/notifications/providers/stomp.js +4 -0
  31. package/package.json +40 -56
  32. package/server/index.js +216 -123
  33. package/server/standalone.js +1 -6
  34. package/util/auth.js +10 -4
  35. package/util/cloudcms.js +77 -35
  36. package/util/loaders.js +113 -0
  37. package/util/proxy-factory.js +143 -168
  38. package/util/request.js +6 -2
  39. package/util/workqueue.js +111 -0
  40. package/.last_command +0 -7
  41. package/duster/helpers/core/cloudcms/associations.js +0 -34
  42. package/duster/helpers/core/cloudcms/beta/markdown.js +0 -46
  43. package/duster/helpers/core/cloudcms/beta/nodeAttachmentText.js +0 -46
  44. package/duster/helpers/core/cloudcms/beta/params.js +0 -33
  45. package/duster/helpers/core/cloudcms/beta/processTemplate.js +0 -82
  46. package/duster/helpers/core/cloudcms/content.js +0 -34
  47. package/duster/helpers/core/cloudcms/expand.js +0 -38
  48. package/duster/helpers/core/cloudcms/form.js +0 -34
  49. package/duster/helpers/core/cloudcms/query.js +0 -34
  50. package/duster/helpers/core/cloudcms/queryOne.js +0 -34
  51. package/duster/helpers/core/cloudcms/relatives.js +0 -34
  52. package/duster/helpers/core/cloudcms/search.js +0 -34
  53. package/duster/helpers/core/cloudcms/searchOne.js +0 -34
  54. package/duster/helpers/core/cloudcms/wcm/dependency.js +0 -83
  55. package/duster/helpers/core/cloudcms/wcm/fragment.js +0 -34
  56. package/duster/helpers/core/dev/debug.js +0 -42
  57. package/duster/helpers/core/dom/block.js +0 -49
  58. package/duster/helpers/core/dom/include.js +0 -38
  59. package/duster/helpers/core/dom/layout.js +0 -49
  60. package/duster/helpers/core/dom/link.js +0 -81
  61. package/duster/helpers/core/dom/resource.js +0 -77
  62. package/duster/helpers/core/engine.js +0 -1580
  63. package/duster/helpers/core/ice/value.js +0 -65
  64. package/duster/helpers/core/index.js +0 -49
  65. package/duster/helpers/core/operators/if.js +0 -64
  66. package/duster/helpers/core/operators/iter.js +0 -45
  67. package/duster/helpers/core/operators/iterate.js +0 -129
  68. package/duster/helpers/sample/nyt.js +0 -114
  69. package/duster/index.js +0 -319
  70. package/duster/support.js +0 -436
  71. package/duster/tracker.js +0 -262
  72. package/middleware/authentication/providers/cas.js +0 -73
  73. package/middleware/authentication/providers/facebook.js +0 -120
  74. package/middleware/authentication/providers/github.js +0 -88
  75. package/middleware/authentication/providers/linkedin.js +0 -112
  76. package/middleware/authentication/providers/twitter.js +0 -120
  77. package/middleware/server-tags/server-tags.js +0 -113
  78. package/middleware/wcm/wcm.js +0 -1437
@@ -1,8 +1,9 @@
1
- //var path = require('path');
2
- //var http = require('http');
3
- //var request = require('request');
4
1
  var util = require("../../util/util");
5
2
 
3
+ var workQueueFactory = require("../../util/workqueue");
4
+
5
+ //var debugLog = process.debugLog;
6
+
6
7
  /**
7
8
  * Retrieves virtual driver configuration for hosts from Cloud CMS.
8
9
  *
@@ -10,7 +11,12 @@ var util = require("../../util/util");
10
11
  */
11
12
  exports = module.exports = function()
12
13
  {
14
+ // ensures that we only load 2 virtual config at a time
15
+ var enqueueLoadVirtualConfig = workQueueFactory("loadVirtualConfigQueue", 2);
16
+
13
17
  var SENTINEL_NOT_FOUND_VALUE = "null";
18
+ var BLACKLIST_TTL_SECONDS = 60 * 60 * 24 * 30; // 30 days
19
+ var DISABLED_TTL_SECONDS = 60 * 10; // 10 minutes
14
20
 
15
21
  var VIRTUAL_DRIVER_CACHE_KEY = "virtualdriver";
16
22
 
@@ -33,12 +39,9 @@ exports = module.exports = function()
33
39
  // force key to "virtualdriver"
34
40
  configuration.virtualDriver.key = VIRTUAL_DRIVER_CACHE_KEY;
35
41
 
36
- console.log("a1: " + JSON.stringify(configuration.virtualDriver, null, 2));
37
-
38
42
  // either connect anew or re-use an existing connection to Cloud CMS for this application
39
43
  Gitana.connect(configuration.virtualDriver, function(err) {
40
-
41
- console.log("a2:" + err);
44
+
42
45
  if (err)
43
46
  {
44
47
  return callback(err);
@@ -59,59 +62,66 @@ exports = module.exports = function()
59
62
  {
60
63
  var configuration = process.configuration;
61
64
 
62
- if (configuration.virtualDriver && configuration.virtualDriver.enabled)
65
+ if (!configuration.virtualDriver || !configuration.virtualDriver.enabled)
63
66
  {
64
- connectAsVirtualDriver(function(err, gitana) {
67
+ return callback();
68
+ }
65
69
 
66
- if (err)
67
- {
68
- return callback(err);
69
- }
70
+ // no appkey, cannot load
71
+ if (!configuration.virtualDriver.appKey)
72
+ {
73
+ return callback();
74
+ }
70
75
 
71
- // no appkey, cannot load
72
- if (!configuration.virtualDriver.appKey)
73
- {
74
- return callback();
75
- }
76
+ connectAsVirtualDriver(function(err, gitana) {
76
77
 
77
- // Basic Authentication request back to server
78
- var qs = {};
79
- qs.h = host;
80
- qs.a = configuration.virtualDriver.appKey;
78
+ if (err)
79
+ {
80
+ return callback(err);
81
+ }
81
82
 
82
- if (configuration.virtualDriver && configuration.virtualDriver.webhost)
83
- {
84
- qs.w = configuration.virtualDriver.webhost;
85
- }
83
+ // Basic Authentication request back to server
84
+ var qs = {};
85
+ qs.h = host;
86
+ qs.a = configuration.virtualDriver.appKey;
86
87
 
87
- var URL = configuration.virtualDriver.baseURL;
88
- if (!URL) {
89
- URL = util.asURL(process.env.GITANA_PROXY_SCHEME, process.env.GITANA_PROXY_HOST, process.env.GITANA_PROXY_PORT, process.env.GITANA_PROXY_PATH);
90
- }
91
- URL += "/virtual/driver/config";
92
- var requestConfig = {
93
- "url": URL,
94
- "qs": qs
95
- };
88
+ if (configuration.virtualDriver && configuration.virtualDriver.webhost)
89
+ {
90
+ qs.w = configuration.virtualDriver.webhost;
91
+ }
96
92
 
97
- util.retryGitanaRequest(logMethod, gitana, requestConfig, 2, function(err, response, json) {
93
+ var URL = configuration.virtualDriver.baseURL;
94
+ if (!URL) {
95
+ URL = util.asURL(process.env.GITANA_PROXY_SCHEME, process.env.GITANA_PROXY_HOST, process.env.GITANA_PROXY_PORT, process.env.GITANA_PROXY_PATH);
96
+ }
97
+ URL += "/virtual/driver/config";
98
+ var requestConfig = {
99
+ "url": URL,
100
+ "qs": qs
101
+ };
98
102
 
99
- if (response && response.status === 200 && json)
100
- {
101
- var config = json.config;
102
- if (!config)
103
- {
104
- // nothing found
105
- return callback();
106
- }
103
+ util.retryGitanaRequest(logMethod, gitana, requestConfig, 2, function(err, response, body) {
107
104
 
105
+ if (response && response.status === 200 && body)
106
+ {
107
+ var config = body.config;
108
+ if (!config)
109
+ {
110
+ // nothing found
111
+ callback();
112
+ }
113
+ else
114
+ {
108
115
  // make sure we update baseURL
109
116
  config.baseURL = configuration.virtualDriver.baseURL;
110
117
 
111
118
  // hand back
112
- return callback(null, config);
119
+ var disabled = body.disabled ? true : false;
120
+ callback(null, config, disabled);
113
121
  }
114
-
122
+ }
123
+ else
124
+ {
115
125
  logMethod("Load virtual driver config failed");
116
126
  if (response && response.status)
117
127
  {
@@ -120,10 +130,13 @@ exports = module.exports = function()
120
130
  if (err) {
121
131
  logMethod("Err: " + JSON.stringify(err));
122
132
  }
123
- if (json) {
124
- logMethod("Body: " + json);
133
+ if (body) {
134
+ logMethod("Body: " + body);
135
+ }
136
+ var message = null;
137
+ if (body) {
138
+ message = JSON.stringify(body);
125
139
  }
126
- var message = json;
127
140
  if (!message) {
128
141
  message = "Unable to load virtual driver configuration";
129
142
  }
@@ -133,24 +146,15 @@ exports = module.exports = function()
133
146
  disconnectVirtualDriver();
134
147
 
135
148
  // fire callback
136
- return callback({
149
+ callback({
137
150
  "message": message,
138
151
  "err": err
139
152
  });
140
- });
153
+ }
141
154
  });
142
- }
143
- else
144
- {
145
- callback();
146
- }
155
+ });
147
156
  };
148
157
 
149
- // var _LOCK = function(lockKey, workFunction)
150
- // {
151
- // process.locks.lock(lockKey, workFunction);
152
- // };
153
-
154
158
  var r = {};
155
159
 
156
160
  /**
@@ -162,166 +166,188 @@ exports = module.exports = function()
162
166
 
163
167
  var VCSENTINEL_CACHE_KEY = "vcSentinelFailed-" + host;
164
168
 
165
- rootStore.existsFile("gitana.json", function(exists) {
169
+ // so that only N number of virtual configs are loaded at a time
170
+ var workFn = function(host, rootStore, logMethod) {
166
171
 
167
- var loadFromRemote = function(finishedLoading) {
172
+ return function(done)
173
+ {
174
+ rootStore.existsFile("gitana.json", function(exists) {
168
175
 
169
- // check cache to see if we already tried to load this in the past few minutes and were sorely disappointed
170
- process.cache.read(VCSENTINEL_CACHE_KEY, function (err, failedRecently) {
176
+ var loadFromRemote = function(finishedLoading) {
171
177
 
172
- if (failedRecently) {
173
- return finishedLoading({
174
- "message": "No virtual config found for host (from previous attempt)"
175
- });
176
- }
178
+ // check cache to see if we already tried to load this in the past few minutes and were sorely disappointed
179
+ process.cache.read(VCSENTINEL_CACHE_KEY, function (err, doesNotExist) {
177
180
 
178
- // load the gitana.json file from Cloud CMS
179
- loadConfigForVirtualHost(host, logMethod, function (err, virtualConfig) {
181
+ if (doesNotExist) {
182
+ return finishedLoading({
183
+ "message": "No virtual config found for host (from previous attempt)"
184
+ }, null, true);
185
+ }
180
186
 
181
- if (err)
182
- {
183
- // something failed, perhaps a network issue
184
- // don't store anything
185
- return finishedLoading(err);
186
- }
187
+ // load the gitana.json file from Cloud CMS
188
+ loadConfigForVirtualHost(host, logMethod, function (err, virtualConfig, disabled) {
187
189
 
188
- if (!virtualConfig)
189
- {
190
- // mark that it failed (5 seconds TTL)
191
- return process.cache.write(VCSENTINEL_CACHE_KEY, SENTINEL_NOT_FOUND_VALUE, 5, function() {
192
- finishedLoading({
193
- "message": "No virtual config found for host: " + host
194
- });
195
- });
196
- }
190
+ if (err)
191
+ {
192
+ // something failed, perhaps a network issue
193
+ // don't store anything
194
+ return finishedLoading(err);
195
+ }
197
196
 
198
- // populate gitana.json
199
- var gitanaJson = {
200
- "clientKey": virtualConfig.clientKey
201
- };
202
- if (virtualConfig.clientSecret) {
203
- gitanaJson.clientSecret = virtualConfig.clientSecret;
204
- }
205
- if (virtualConfig.username) {
206
- gitanaJson.username = virtualConfig.username;
207
- }
208
- if (virtualConfig.password) {
209
- gitanaJson.password = virtualConfig.password;
210
- }
211
- if (virtualConfig.application) {
212
- gitanaJson.application = virtualConfig.application;
213
- }
214
- if (virtualConfig.baseURL) {
215
- gitanaJson.baseURL = virtualConfig.baseURL;
216
- }
217
- if (!gitanaJson.baseURL)
218
- {
219
- gitanaJson.baseURL = util.cleanupURL(util.asURL(process.env.GITANA_PROXY_SCHEME, process.env.GITANA_PROXY_HOST, process.env.GITANA_PROXY_PORT, process.env.GITANA_PROXY_PATH));
220
- }
197
+ if (!virtualConfig)
198
+ {
199
+ // mark that it failed (30 day blacklist TTL)
200
+ return process.cache.write(VCSENTINEL_CACHE_KEY, true, BLACKLIST_TTL_SECONDS, function() {
201
+ finishedLoading({
202
+ "message": "No virtual config found for host: " + host
203
+ });
204
+ });
205
+ }
221
206
 
222
- // mark as retrieved from virtual driver
223
- gitanaJson._virtual = true;
207
+ if (disabled)
208
+ {
209
+ // mark that the virtual config is disabled (10 minutes TLL)
210
+ return process.cache.write(VCSENTINEL_CACHE_KEY, true, DISABLED_TTL_SECONDS, function() {
211
+ finishedLoading({
212
+ "message": "The virtual config was found for host: " + host + " but it has been marked as disabled"
213
+ });
214
+ });
215
+ }
224
216
 
225
- // write the gitana.json file
226
- rootStore.writeFile("gitana.json", JSON.stringify(gitanaJson, null, " "), function (err) {
217
+ // populate gitana.json
218
+ var gitanaJson = {
219
+ "clientKey": virtualConfig.clientKey
220
+ };
221
+ if (virtualConfig.clientSecret) {
222
+ gitanaJson.clientSecret = virtualConfig.clientSecret;
223
+ }
224
+ if (virtualConfig.username) {
225
+ gitanaJson.username = virtualConfig.username;
226
+ }
227
+ if (virtualConfig.password) {
228
+ gitanaJson.password = virtualConfig.password;
229
+ }
230
+ if (virtualConfig.application) {
231
+ gitanaJson.application = virtualConfig.application;
232
+ }
233
+ if (virtualConfig.baseURL) {
234
+ gitanaJson.baseURL = virtualConfig.baseURL;
235
+ }
236
+ if (!gitanaJson.baseURL)
237
+ {
238
+ gitanaJson.baseURL = util.cleanupURL(util.asURL(process.env.GITANA_PROXY_SCHEME, process.env.GITANA_PROXY_HOST, process.env.GITANA_PROXY_PORT, process.env.GITANA_PROXY_PATH));
239
+ }
240
+
241
+ // mark as retrieved from virtual driver
242
+ gitanaJson._virtual = true;
243
+
244
+ // write the gitana.json file
245
+ rootStore.writeFile("gitana.json", JSON.stringify(gitanaJson, null, " "), function (err) {
246
+
247
+ // if we failed to write the file, then delete and call back with error
248
+ if (err)
249
+ {
250
+ return rootStore.deleteFile("gitana.json", function() {
251
+ finishedLoading(err);
252
+ });
253
+ }
254
+
255
+ // make sure the file wrote successfully
256
+ // check stats, ensure non-error and file size > 0
257
+ rootStore.fileStats("gitana.json", function(err, stats) {
258
+
259
+ // if we failed to read stats, then delete and call back with error
260
+ if (err || stats.size === 0)
261
+ {
262
+ return rootStore.deleteFile("gitana.json", function() {
263
+ finishedLoading({
264
+ "message": "There was a problem writing the driver configuration file. Please reload."
265
+ });
266
+ });
267
+ }
268
+
269
+ finishedLoading(null, gitanaJson);
270
+ });
271
+ });
272
+ });
273
+ });
274
+ };
275
+
276
+ if (exists)
277
+ {
278
+ // read gitana json and send back
279
+ rootStore.readFile("gitana.json", function(err, data) {
227
280
 
228
- // if we failed to write the file, then delete and call back with error
229
281
  if (err)
230
282
  {
231
- return rootStore.deleteFile("gitana.json", function() {
232
- finishedLoading(err);
233
- });
283
+ return done(err);
284
+ }
285
+
286
+ if (!data)
287
+ {
288
+ return done({
289
+ "message": "The gitana.json data read from disk was null or empty"
290
+ })
234
291
  }
235
292
 
236
- // make sure the file wrote successfully
237
- // check stats, ensure non-error and file size > 0
293
+ // make sure not size 0
238
294
  rootStore.fileStats("gitana.json", function(err, stats) {
239
295
 
240
- // if we failed to read stats, then delete and call back with error
296
+ if (err)
297
+ {
298
+ return done(err);
299
+ }
300
+
301
+ // if we failed to read stats or file size 0, then delete and call back with error
241
302
  if (err || stats.size === 0)
242
303
  {
243
304
  return rootStore.deleteFile("gitana.json", function() {
244
- finishedLoading({
305
+ done({
245
306
  "message": "There was a problem writing the driver configuration file. Please reload."
246
307
  });
247
308
  });
248
309
  }
249
310
 
250
- finishedLoading(null, gitanaJson);
251
- });
252
- });
253
- });
254
- });
255
- };
311
+ // remove vcSentinel if it exists
312
+ process.cache.remove(VCSENTINEL_CACHE_KEY);
256
313
 
257
- if (exists)
258
- {
259
- // read gitana json and send back
260
- rootStore.readFile("gitana.json", function(err, data) {
314
+ var gitanaJson = JSON.parse("" + data);
261
315
 
262
- if (err)
263
- {
264
- return callback(err);
265
- }
266
-
267
- if (!data)
268
- {
269
- return callback({
270
- "message": "The gitana.json data read from disk was null or empty"
271
- })
272
- }
316
+ // auto-upgrade the host?
317
+ if (gitanaJson.baseURL)
318
+ {
319
+ var newBaseURL = util.cleanupURL(gitanaJson.baseURL);
320
+ if (newBaseURL !== gitanaJson.baseURL)
321
+ {
322
+ console.log("Auto-upgrade gitana.json from: " + gitanaJson.baseURL + ", to: " + newBaseURL);
273
323
 
274
- // make sure not size 0
275
- rootStore.fileStats("gitana.json", function(err, stats) {
324
+ gitanaJson.baseURL = newBaseURL;
276
325
 
277
- if (err)
278
- {
279
- return callback(err);
280
- }
326
+ // write the gitana.json file
327
+ rootStore.writeFile("gitana.json", JSON.stringify(gitanaJson, null, " "), function (err) {
328
+ // nada
329
+ });
330
+ }
331
+ }
281
332
 
282
- // if we failed to read stats or file size 0, then delete and call back with error
283
- if (err || stats.size === 0)
284
- {
285
- return rootStore.deleteFile("gitana.json", function() {
286
- callback({
287
- "message": "There was a problem writing the driver configuration file. Please reload."
288
- });
333
+ // otherwise, fine!
334
+ done(null, gitanaJson);
289
335
  });
290
- }
291
-
292
- // remove vcSentinel if it exists
293
- process.cache.remove(VCSENTINEL_CACHE_KEY);
294
-
295
- var gitanaJson = JSON.parse("" + data);
296
-
297
- // auto-upgrade the host?
298
- if (gitanaJson.baseURL)
299
- {
300
- var newBaseURL = util.cleanupURL(gitanaJson.baseURL);
301
- if (newBaseURL !== gitanaJson.baseURL)
302
- {
303
- console.log("Auto-upgrade gitana.json from: " + gitanaJson.baseURL + ", to: " + newBaseURL);
304
-
305
- gitanaJson.baseURL = newBaseURL;
306
-
307
- // write the gitana.json file
308
- rootStore.writeFile("gitana.json", JSON.stringify(gitanaJson, null, " "), function (err) {
309
- // nada
310
- });
311
- }
312
- }
313
-
314
- // otherwise, fine!
315
- callback(null, gitanaJson);
316
- });
317
- });
318
- }
319
- else
320
- {
321
- loadFromRemote(function(err, gitanaJson) {
322
- callback(err, gitanaJson);
336
+ });
337
+ }
338
+ else
339
+ {
340
+ loadFromRemote(function(err, gitanaJson, doesNotExist) {
341
+ done(err, gitanaJson, doesNotExist);
342
+ });
343
+ }
323
344
  });
324
345
  }
346
+
347
+ }(host, rootStore, logMethod);
348
+
349
+ enqueueLoadVirtualConfig(workFn, function(err, gitanaJson, doesNotExist) {
350
+ callback(err, gitanaJson, doesNotExist);
325
351
  });
326
352
  };
327
353
 
@@ -345,15 +371,38 @@ exports = module.exports = function()
345
371
  configuration.key = "virtual";
346
372
  }
347
373
 
348
- var completionFunction = function (err, gitanaConfig) {
349
- if (err) {
350
- if (err.message) {
374
+ var completionFunction = function (err, gitanaConfig, doesNotExist)
375
+ {
376
+ if (doesNotExist)
377
+ {
378
+ // console.log("BLOCK, method: " + req.method + ", url: " + req.url);
379
+ // if (req.headers)
380
+ // {
381
+ // console.log(" -> headers: " + JSON.stringify(req.headers, null, 2));
382
+ // }
383
+ // if (req.query)
384
+ // {
385
+ // console.log(" -> query: " + JSON.stringify(req.query, null, 2));
386
+ // }
387
+ //
388
+ // are we being spoofed? kill the connection
389
+ res.blocked = true;
390
+ res.writeHead(503, { 'Content-Type': 'application/json' });
391
+ return res.end(JSON.stringify({"error": true, "message": "Bad Request."}));
392
+ }
393
+
394
+ if (err)
395
+ {
396
+ if (err.message)
397
+ {
351
398
  req.log(err.message);
352
399
  }
400
+
353
401
  return next();
354
402
  }
355
403
 
356
- if (gitanaConfig) {
404
+ if (gitanaConfig)
405
+ {
357
406
  // store config
358
407
  req.gitanaConfig = gitanaConfig;
359
408
 
@@ -375,7 +424,7 @@ exports = module.exports = function()
375
424
  if (cachedValue === SENTINEL_NOT_FOUND_VALUE)
376
425
  {
377
426
  // null means there verifiably isn't anything on disk (null used as sentinel marker)
378
- completionFunction();
427
+ completionFunction(null, null, true);
379
428
  }
380
429
  else
381
430
  {
@@ -386,29 +435,27 @@ exports = module.exports = function()
386
435
  else
387
436
  {
388
437
  // try to load from disk
389
- acquireGitanaJson(req.virtualHost, req.rootStore, req.log, function (err, gitanaConfig)
438
+ acquireGitanaJson(req.virtualHost, req.rootStore, req.log, function (err, gitanaConfig, doesNotExist)
390
439
  {
391
- if (err)
440
+ if (err && !doesNotExist)
392
441
  {
393
442
  return completionFunction(err);
394
443
  }
395
444
 
396
445
  if (gitanaConfig)
397
446
  {
398
- process.driverConfigCache.write(req.virtualHost, {
447
+ return process.driverConfigCache.write(req.virtualHost, {
399
448
  "config": gitanaConfig
400
449
  }, function (err) {
401
- completionFunction(null, gitanaConfig);
402
- });
403
- }
404
- else
405
- {
406
- // mark with sentinel
407
- process.driverConfigCache.write(req.virtualHost, SENTINEL_NOT_FOUND_VALUE, 5, function (err)
408
- {
409
- completionFunction();
450
+ completionFunction(err, gitanaConfig);
410
451
  });
411
452
  }
453
+
454
+ // mark with sentinel (30 minutes)
455
+ req.log("[BLACKLIST] Adding: " + req.virtualHost);
456
+ process.driverConfigCache.write(req.virtualHost, SENTINEL_NOT_FOUND_VALUE, BLACKLIST_TTL_SECONDS, function (err) {
457
+ completionFunction(null, null, true);
458
+ });
412
459
  });
413
460
  }
414
461
  });
@@ -1,6 +1,3 @@
1
- var path = require('path');
2
- var http = require('http');
3
- var request = require('request');
4
1
  var util = require("../../util/util");
5
2
 
6
3
  /**
@@ -1,7 +1,4 @@
1
1
  var path = require('path');
2
- var fs = require('fs');
3
- var http = require('http');
4
- var request = require('request');
5
2
  var util = require("../../util/util");
6
3
 
7
4
  /**