cloudcms-server 3.3.1-beta.9 → 4.0.0-beta.2

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 (108) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +1 -1
  3. package/broadcast/broadcast.js +6 -3
  4. package/broadcast/providers/redis.js +24 -49
  5. package/clients/nrp.js +117 -0
  6. package/clients/redis.js +64 -0
  7. package/d1/index.js +629 -0
  8. package/d1/index.js.works +203 -0
  9. package/d1/package.json +86 -0
  10. package/d1/package.json.works +14 -0
  11. package/duster/helpers/sample/nyt.js +2 -1
  12. package/framework/controllers.js +4 -4
  13. package/index.js +21 -14
  14. package/insight/insight.js +1 -1
  15. package/launchpad/index.js +203 -11
  16. package/launchpad/launchers/cluster.js +103 -110
  17. package/launchpad/launchers/redis.js +70 -0
  18. package/launchpad/launchers/single.js +36 -22
  19. package/locks/locks.js +63 -9
  20. package/locks/providers/cluster.js +3 -1
  21. package/locks/providers/memory.js +10 -7
  22. package/locks/providers/redis.js +62 -82
  23. package/middleware/admin/admin.js +3 -3
  24. package/middleware/authentication/adapters/session.js +11 -8
  25. package/middleware/authentication/authentication.js +28 -16
  26. package/middleware/authentication/authenticators/default.js +5 -2
  27. package/middleware/authentication/authenticators/session.js +5 -2
  28. package/middleware/authentication/providers/saml.js +1 -1
  29. package/middleware/authorization/authorization.js +11 -8
  30. package/middleware/awareness/awareness.js +55 -31
  31. package/middleware/awareness/plugins/editorial.js +4 -4
  32. package/middleware/awareness/providers/abstract-async.js +107 -84
  33. package/middleware/awareness/providers/abstract.js +1 -1
  34. package/middleware/awareness/providers/memory.js +0 -14
  35. package/middleware/awareness/providers/redis.js +186 -279
  36. package/middleware/cache/cache.js +4 -2
  37. package/middleware/cache/providers/redis.js +127 -89
  38. package/middleware/cache/providers/shared-memory.js +3 -3
  39. package/middleware/cloudcms/cloudcms.js +22 -16
  40. package/middleware/form/form.js +3 -3
  41. package/middleware/modules/modules.js +6 -3
  42. package/middleware/proxy/proxy.js +8 -21
  43. package/middleware/stores/stores.js +2 -2
  44. package/middleware/virtual-config/virtual-config.js +11 -8
  45. package/middleware/wcm/wcm.js +4 -4
  46. package/notifications/notifications.js +2 -2
  47. package/package.json +29 -25
  48. package/server/index.js +504 -415
  49. package/server/standalone.js +9 -0
  50. package/temp/clusterlock/index.js +3 -3
  51. package/temp/clusterlock/package.json +1 -1
  52. package/temp/passport-saml/LICENSE +23 -0
  53. package/temp/passport-saml/README.md +406 -0
  54. package/temp/passport-saml/lib/node-saml/algorithms.d.ts +5 -0
  55. package/temp/passport-saml/lib/node-saml/algorithms.js +41 -0
  56. package/temp/passport-saml/lib/node-saml/algorithms.js.map +1 -0
  57. package/temp/passport-saml/lib/node-saml/index.d.ts +3 -0
  58. package/temp/passport-saml/lib/node-saml/index.js +6 -0
  59. package/temp/passport-saml/lib/node-saml/index.js.map +1 -0
  60. package/temp/passport-saml/lib/node-saml/inmemory-cache-provider.d.ts +45 -0
  61. package/temp/passport-saml/lib/node-saml/inmemory-cache-provider.js +86 -0
  62. package/temp/passport-saml/lib/node-saml/inmemory-cache-provider.js.map +1 -0
  63. package/temp/passport-saml/lib/node-saml/saml-post-signing.d.ts +3 -0
  64. package/temp/passport-saml/lib/node-saml/saml-post-signing.js +15 -0
  65. package/temp/passport-saml/lib/node-saml/saml-post-signing.js.map +1 -0
  66. package/temp/passport-saml/lib/node-saml/saml.d.ts +77 -0
  67. package/temp/passport-saml/lib/node-saml/saml.js +1170 -0
  68. package/temp/passport-saml/lib/node-saml/saml.js.map +1 -0
  69. package/temp/passport-saml/lib/node-saml/types.d.ts +95 -0
  70. package/temp/passport-saml/lib/node-saml/types.js +8 -0
  71. package/temp/passport-saml/lib/node-saml/types.js.map +1 -0
  72. package/temp/passport-saml/lib/node-saml/utility.d.ts +3 -0
  73. package/temp/passport-saml/lib/node-saml/utility.js +19 -0
  74. package/temp/passport-saml/lib/node-saml/utility.js.map +1 -0
  75. package/temp/passport-saml/lib/node-saml/xml.d.ts +21 -0
  76. package/temp/passport-saml/lib/node-saml/xml.js +140 -0
  77. package/temp/passport-saml/lib/node-saml/xml.js.map +1 -0
  78. package/temp/passport-saml/lib/passport-saml/index.d.ts +6 -0
  79. package/temp/passport-saml/lib/passport-saml/index.js +11 -0
  80. package/temp/passport-saml/lib/passport-saml/index.js.map +1 -0
  81. package/temp/passport-saml/lib/passport-saml/multiSamlStrategy.d.ts +13 -0
  82. package/temp/passport-saml/lib/passport-saml/multiSamlStrategy.js +63 -0
  83. package/temp/passport-saml/lib/passport-saml/multiSamlStrategy.js.map +1 -0
  84. package/temp/passport-saml/lib/passport-saml/strategy.d.ts +20 -0
  85. package/temp/passport-saml/lib/passport-saml/strategy.js +167 -0
  86. package/temp/passport-saml/lib/passport-saml/strategy.js.map +1 -0
  87. package/temp/passport-saml/lib/passport-saml/types.d.ts +51 -0
  88. package/temp/passport-saml/lib/passport-saml/types.js +11 -0
  89. package/temp/passport-saml/lib/passport-saml/types.js.map +1 -0
  90. package/temp/passport-saml/package.json +96 -0
  91. package/util/auth.js +6 -6
  92. package/util/cloudcms.js +106 -118
  93. package/util/proxy-factory.js +159 -268
  94. package/util/redis.js +113 -0
  95. package/util/renditions.js +12 -6
  96. package/util/request.js +12 -6
  97. package/util/util.js +16 -2
  98. package/launchpad/launchers/sticky-cluster.js +0 -43
  99. package/temp/memored/.jshintrc +0 -4
  100. package/temp/memored/README.md +0 -240
  101. package/temp/memored/demo/demo1.js +0 -37
  102. package/temp/memored/demo/demo2.js +0 -32
  103. package/temp/memored/gulpfile.js +0 -8
  104. package/temp/memored/index.js +0 -343
  105. package/temp/memored/package.json +0 -54
  106. package/temp/memored/spec/memored.spec.js +0 -265
  107. package/web/cms/ice.js +0 -109
  108. package/web/cms/preview.js +0 -106
@@ -1,7 +1,5 @@
1
- var path = require("path");
2
-
3
- var redis = require("redis");
4
- var logFactory = require("../../../util/logger");
1
+ var redisClientFactory = require("../../../clients/redis");
2
+ const redisHelper = require("../../../util/redis");
5
3
 
6
4
  /**
7
5
  * Redis distributed cache.
@@ -11,123 +9,163 @@ var logFactory = require("../../../util/logger");
11
9
  exports = module.exports = function(cacheConfig)
12
10
  {
13
11
  var client = null;
14
-
15
- var logger = this.logger = logFactory("REDIS CACHE");
16
- logger.setLevel("error");
17
-
18
- // allow for global redis default
19
- // allow for redis broadcast specific
20
- // otherwise default to error
21
- if (typeof(process.env.CLOUDCMS_REDIS_DEBUG_LEVEL) !== "undefined") {
22
- logger.setLevel(("" + process.env.CLOUDCMS_REDIS_DEBUG_LEVEL).toLowerCase(), true);
23
- }
24
- else if (typeof(process.env.CLOUDCMS_CACHE_REDIS_DEBUG_LEVEL) !== "undefined") {
25
- logger.setLevel(("" + process.env.CLOUDCMS_CACHE_REDIS_DEBUG_LEVEL).toLowerCase(), true);
26
- }
12
+
13
+ var logger = redisHelper.redisLogger("REDIS_CACHE", "CLOUDCMS_CACHE_", "error")
27
14
 
28
15
  var r = {};
29
16
 
30
17
  r.init = function(callback)
31
18
  {
32
- var redisPort = cacheConfig.port;
33
- if (typeof(redisPort) === "undefined" || !redisPort)
34
- {
35
- redisPort = process.env.CLOUDCMS_CACHE_REDIS_PORT;
36
- }
37
- if (typeof(redisPort) === "undefined" || !redisPort)
38
- {
39
- redisPort = process.env.CLOUDCMS_REDIS_PORT;
40
- }
41
-
42
- var redisEndpoint = cacheConfig.endpoint;
43
- if (typeof(redisEndpoint) === "undefined" || !redisEndpoint)
44
- {
45
- redisEndpoint = process.env.CLOUDCMS_CACHE_REDIS_ENDPOINT;
46
- }
47
- if (typeof(redisEndpoint) === "undefined" || !redisEndpoint)
48
- {
49
- redisEndpoint = process.env.CLOUDCMS_REDIS_ENDPOINT;
50
- }
51
-
52
- var redisOptions = {};
53
-
54
- //redis.debug_mode = true;
55
-
56
- client = redis.createClient(redisPort, redisEndpoint, redisOptions);
57
-
58
- callback();
19
+ redisClientFactory.create(cacheConfig, function(err, _client) {
20
+
21
+ if (err) {
22
+ return callback(err);
23
+ }
24
+
25
+ client = _client;
26
+
27
+ return callback();
28
+
29
+ });
59
30
  };
60
31
 
61
32
  r.write = function(key, value, seconds, callback)
62
33
  {
63
- if (seconds <= -1)
64
- {
65
- client.set([key, JSON.stringify(value)], function(err, reply) {
66
- if (err) {
67
- logger.error("write error. key: " + key + " value: " + JSON.stringify(value) + ". error:" + err);
34
+ logger.info('write, key = ' + key + ', value = ' + value + ', seconds = ' + seconds + ', typeofval: ' + typeof(value));
35
+ (async function() {
36
+
37
+ var reply = null;
38
+ var err = null;
39
+
40
+ try
41
+ {
42
+ var config = {};
43
+ if (seconds >= 0) {
44
+ config["EX"] = seconds;
68
45
  }
46
+
47
+ reply = await client.set(key, JSON.stringify(value), config);
48
+ }
49
+ catch (e)
50
+ {
51
+ err = e;
52
+ }
53
+
54
+ if (reply) {
69
55
  logger.info("write -> reply = " + reply);
70
- callback(err, reply);
71
- });
72
- }
73
- else
74
- {
75
- client.set([key, JSON.stringify(value), "EX", seconds], function(err, reply) {
76
- if (err) {
77
- logger.error("write.ex error. key: " + key + " value: " + JSON.stringify(value) + ". error:" + err);
78
- }
79
- logger.info("write.ex -> reply = " + reply);
80
- callback(err, reply);
81
- });
82
- }
56
+ }
57
+
58
+ if (err) {
59
+ logger.error("write error. key: " + key + " value: " + JSON.stringify(value) + ". error:" + err + ", value type: " + typeof(value));
60
+ }
61
+
62
+ callback(err, reply);
63
+
64
+ })();
83
65
  };
84
66
 
85
-     r.read = function(key, callback)
86
-     {
87
-         client.get([key], function(err, reply) {
67
+ r.read = function(key, callback)
68
+ {
69
+ logger.info('read, key = ' + key);
88
70
 
71
+ (async function() {
72
+
73
+ var err = null;
74
+ var reply = null;
75
+
76
+ try
77
+ {
78
+ reply = await client.get(key);
79
+ }
80
+ catch (e)
81
+ {
82
+ err = e;
83
+ }
84
+
89
85
  if (err) {
90
- logger.error("read error. key: " + key + ". error:" + err);
86
+ logger.error("read error. key: " + key + ". error: " + err);
87
+ }
88
+
89
+ if (reply) {
90
+ logger.info("read. key: " + key + " -> reply = " + reply);
91
91
  }
92
- logger.info("read. key: " + key + " -> reply = " + reply);
93
-             
92
+
94
93
  var result = null;
95
-             try
94
+ try
96
95
  {
97
-                 result = JSON.parse(reply);
98
-             }
96
+ result = JSON.parse(reply);
97
+ }
99
98
  catch (ex)
100
99
  {
101
-                 result = null;
102
-                 err = ex;
103
- if (err) {
100
+ result = null;
101
+ err = ex;
102
+
103
+ if (err)
104
+ {
104
105
  logger.error("error parsing reply. key: " + key + ". error:" + err);
105
106
  }
106
-             }
107
-
107
+ }
108
+
108
109
  callback(err, result);
109
-         });
110
-     };
110
+ })();
111
+ };
111
112
 
112
113
  r.remove = function(key, callback)
113
114
  {
114
- logger.info("remove. key: " + key);
115
- client.del([key], function(err) {
115
+ logger.info('remove, key = ' + key);
116
+
117
+ (async function() {
118
+
119
+ var err = null;
120
+
121
+ try
122
+ {
123
+ await client.del(key);
124
+ logger.info("remove. key: " + key);
125
+ }
126
+ catch (e)
127
+ {
128
+ err = e;
129
+ }
130
+
131
+ if (err) {
132
+ logger.error("del error. key: " + key + ". error: " + err);
133
+ }
134
+
116
135
  callback(err);
117
- });
136
+ })();
118
137
  };
119
138
 
120
139
  r.keys = function(prefix, callback)
121
-     {
122
- logger.info('keys. prefix = ' + prefix);
123
-         client.keys([prefix + '*'], function(err, reply) {
140
+ {
141
+ logger.info('keys, prefix = ' + prefix);
142
+
143
+ (async function() {
144
+
145
+ var err = null;
146
+ var reply = null;
147
+
148
+ try
149
+ {
150
+ reply = await client.keys(prefix + '*');
151
+ }
152
+ catch (e)
153
+ {
154
+ err = e;
155
+ }
156
+
124
157
  if (err) {
125
- logger.error("error reading prefix: " + prefix + ". error:" + err);
158
+ logger.error("error reading keys for prefix: " + prefix + ". error:" + err);
126
159
  }
127
- logger.info("[keys -> reply = " + reply);
128
-             callback(err, reply);
129
-         });
130
-     };
160
+
161
+ if (reply) {
162
+ logger.info("keys -> reply = " + reply);
163
+ }
164
+
165
+ callback(err, reply);
166
+
167
+ })();
168
+ };
131
169
 
132
170
  return r;
133
171
  };
@@ -1,7 +1,7 @@
1
- var path = require("path");
2
- var memored = require('../../../temp/memored');
1
+ //var path = require("path");
2
+ var memored = require("memored");
3
3
 
4
- var cluster = require("cluster");
4
+ //var cluster = require("cluster");
5
5
 
6
6
  /**
7
7
  * Shared cluster memory using memored
@@ -436,8 +436,18 @@ exports = module.exports = function()
436
436
  }
437
437
 
438
438
  // only allow one "thread" at a time to load the branch
439
- _LOCK(cacheKey, function(releaseLockFn) {
440
-
439
+ _LOCK(cacheKey, function(err, releaseLockFn) {
440
+
441
+ if (err) {
442
+ return callback(err);
443
+ }
444
+
445
+ var branch = CACHED_BRANCHES[cacheKey];
446
+ if (branch) {
447
+ callback(null, Chain(branch));
448
+ return releaseLockFn();
449
+ }
450
+
441
451
  var loadFn = function(finished) {
442
452
 
443
453
  Chain(repository).trap(function(e) {
@@ -464,23 +474,21 @@ exports = module.exports = function()
464
474
 
465
475
  if (err) {
466
476
 
477
+ callback(err);
478
+
467
479
  // release the lock
468
- releaseLockFn();
469
-
470
- // do the callback
471
- return callback(err);
480
+ return releaseLockFn();
472
481
  }
473
482
 
474
483
  // success!
475
484
 
476
485
  // store in cache
477
486
  CACHED_BRANCHES[cacheKey] = branch;
478
-
487
+
488
+ callback(null, branch);
489
+
479
490
  // release the lock
480
- releaseLockFn();
481
-
482
- // do the callback
483
- return callback(null, branch);
491
+ return releaseLockFn();
484
492
  });
485
493
  }
486
494
 
@@ -1439,11 +1447,10 @@ exports = module.exports = function()
1439
1447
 
1440
1448
  // the range requested (for streaming)
1441
1449
  //var range = req.headers["range"];
1442
-
1450
+
1443
1451
  cloudcmsUtil.preview(contentStore, gitana, repositoryId, branchId, nodeId, nodePath, attachmentId, locale, previewId, size, mimetype, forceReload, function(err, filePath, cacheInfo, releaseLock) {
1444
1452
 
1445
- if (err)
1446
- {
1453
+ if (err) {
1447
1454
  req.log("Error on preview node: " + err.message + ", err: " + JSON.stringify(err));
1448
1455
  }
1449
1456
 
@@ -1475,8 +1482,7 @@ exports = module.exports = function()
1475
1482
  // UZI: file deleted by invalidate before this gets called
1476
1483
  contentStore.sendFile(res, filePath, cacheInfo, function(err) {
1477
1484
 
1478
- if (err)
1479
- {
1485
+ if (err) {
1480
1486
  util.handleSendFileError(req, res, filePath, cacheInfo, req.log, err);
1481
1487
  }
1482
1488
 
@@ -120,7 +120,7 @@ exports = module.exports = function()
120
120
  }
121
121
 
122
122
  // post form to Cloud CMS using public method
123
- var URL = util.asURL(process.env.GITANA_PROXY_SCHEME, process.env.GITANA_PROXY_HOST, process.env.GITANA_PROXY_PORT) + url;
123
+ var URL = util.asURL(process.env.GITANA_PROXY_SCHEME, process.env.GITANA_PROXY_HOST, process.env.GITANA_PROXY_PORT, process.env.GITANA_PROXY_PATH) + url;
124
124
 
125
125
  var headers = {};
126
126
  headers["Authorization"] = req.gitana.platform().getDriver().getHttpHeaders()["Authorization"];
@@ -183,8 +183,8 @@ exports = module.exports = function()
183
183
  req.branch(function(err, branch) {
184
184
 
185
185
  var url = branch.getUri() + "/alpaca/datasource";
186
-
187
- var URL = util.asURL(process.env.GITANA_PROXY_SCHEME, process.env.GITANA_PROXY_HOST, process.env.GITANA_PROXY_PORT) + url;
186
+
187
+ var URL = util.asURL(process.env.GITANA_PROXY_SCHEME, process.env.GITANA_PROXY_HOST, process.env.GITANA_PROXY_PORT, process.env.GITANA_PROXY_PATH) + url;
188
188
 
189
189
  var headers = {};
190
190
  headers["Authorization"] = req.gitana.platform().getDriver().getHttpHeaders()["Authorization"];
@@ -101,15 +101,18 @@ exports = module.exports = function()
101
101
 
102
102
  var targetStore = stores["modules"];
103
103
  var targetOffsetPath = moduleId;
104
-
104
+
105
+ //logFn("From: " + sourceType + ", " + sourceUrl + ", " + sourcePath + ", " + sourceBranch);
106
+ //logFn("To: " + targetStore + ", path: " + targetOffsetPath);
107
+
105
108
  util.gitCheckout(host, sourceType, sourceUrl, sourcePath, sourceBranch, targetStore, targetOffsetPath, false, logFn, function (err) {
106
109
 
107
- //logFn("After util.gitCheckout: " + JSON.stringify(err));
110
+ logFn("After util.gitCheckout: " + JSON.stringify(err));
108
111
 
109
112
  // invalidate any caching within the stores layer
110
113
  storeService.invalidate(host);
111
114
 
112
- //logFn("After store.invalidate");
115
+ logFn("After store.invalidate");
113
116
 
114
117
  // broadcast: module_after_deploy
115
118
  process.broadcast.publish("module_after_deploy", {
@@ -1,16 +1,6 @@
1
1
  var path = require('path');
2
- // var fs = require('fs');
3
- // var http = require('http');
4
- // var https = require('https');
5
-
6
- // var httpProxy = require('http-proxy');
7
-
8
- // var oauth2 = require("../../util/oauth2")();
9
-
10
- // var async = require("async");
11
2
 
12
3
  var util = require("../../util/util");
13
- // var auth = require("../../util/auth");
14
4
 
15
5
  var proxyFactory = require("../../util/proxy-factory");
16
6
 
@@ -82,20 +72,17 @@ exports = module.exports = function()
82
72
  contentStore.existsFile(filePath, function(exists) {
83
73
 
84
74
  if (!exists) {
85
- callback();
86
- return;
75
+ return callback();
87
76
  }
88
77
 
89
78
  contentStore.fileStats(filePath, function(err, stats) {
90
79
 
91
80
  if (err) {
92
- callback();
93
- return;
81
+ return callback();
94
82
  }
95
83
 
96
- if (stats.size == 0) {
97
- callback();
98
- return;
84
+ if (stats.size === 0) {
85
+ return callback();
99
86
  }
100
87
 
101
88
  var handleGoodStream = function()
@@ -117,8 +104,7 @@ exports = module.exports = function()
117
104
  // check cacheInfo for expireTime
118
105
  contentStore.readFile(filePath + ".cache", function(err, cacheInfoText) {
119
106
 
120
- if (err || !cacheInfoText)
121
- {
107
+ if (err || !cacheInfoText) {
122
108
  return handleBadStream();
123
109
  }
124
110
 
@@ -215,7 +201,7 @@ exports = module.exports = function()
215
201
  contentStore.writeFile(filePath + ".cache", JSON.stringify(cacheInfo), function() {
216
202
  _end.call(res, data, encoding);
217
203
  });
218
- `` };
204
+ };
219
205
 
220
206
  callback();
221
207
  });
@@ -237,7 +223,7 @@ exports = module.exports = function()
237
223
  {
238
224
  req.url = "/";
239
225
  }
240
-
226
+
241
227
  // caching scenario
242
228
  _handleCacheRead(req, function (err, readStream) {
243
229
 
@@ -257,6 +243,7 @@ exports = module.exports = function()
257
243
  "message": "Missing baseURL from request bound gitana-config"
258
244
  });
259
245
  }
246
+
260
247
  proxyFactory.acquireProxyHandler(proxyTarget, null, function(err, proxyHandler) {
261
248
  if (err) {
262
249
  return next(err);
@@ -46,7 +46,7 @@ exports = module.exports = function()
46
46
  var engineId = storeConfiguration[storeType];
47
47
 
48
48
  var engine = ENGINES[engineId];
49
-
49
+
50
50
  var engineType = process.configuration.storeEngines[engineId].type;
51
51
  var engineConfiguration = process.configuration.storeEngines[engineId].config;
52
52
 
@@ -176,7 +176,7 @@ exports = module.exports = function()
176
176
  if (!stores) {
177
177
  return afterCheck();
178
178
  }
179
-
179
+
180
180
  return process.cache.read("module-descriptors-" + host, function(err, moduleDescriptorsForHost) {
181
181
 
182
182
  if (err) {
@@ -33,9 +33,12 @@ exports = module.exports = function()
33
33
  // force key to "virtualdriver"
34
34
  configuration.virtualDriver.key = VIRTUAL_DRIVER_CACHE_KEY;
35
35
 
36
+ console.log("a1: " + JSON.stringify(configuration.virtualDriver, null, 2));
37
+
36
38
  // either connect anew or re-use an existing connection to Cloud CMS for this application
37
39
  Gitana.connect(configuration.virtualDriver, function(err) {
38
-
40
+
41
+ console.log("a2:" + err);
39
42
  if (err)
40
43
  {
41
44
  return callback(err);
@@ -83,7 +86,7 @@ exports = module.exports = function()
83
86
 
84
87
  var URL = configuration.virtualDriver.baseURL;
85
88
  if (!URL) {
86
- URL = util.asURL(process.env.GITANA_PROXY_SCHEME, process.env.GITANA_PROXY_HOST, process.env.GITANA_PROXY_PORT);
89
+ URL = util.asURL(process.env.GITANA_PROXY_SCHEME, process.env.GITANA_PROXY_HOST, process.env.GITANA_PROXY_PORT, process.env.GITANA_PROXY_PATH);
87
90
  }
88
91
  URL += "/virtual/driver/config";
89
92
  var requestConfig = {
@@ -143,10 +146,10 @@ exports = module.exports = function()
143
146
  }
144
147
  };
145
148
 
146
- var _LOCK = function(lockKey, workFunction)
147
- {
148
- process.locks.lock(lockKey, workFunction);
149
- };
149
+ // var _LOCK = function(lockKey, workFunction)
150
+ // {
151
+ // process.locks.lock(lockKey, workFunction);
152
+ // };
150
153
 
151
154
  var r = {};
152
155
 
@@ -213,7 +216,7 @@ exports = module.exports = function()
213
216
  }
214
217
  if (!gitanaJson.baseURL)
215
218
  {
216
- gitanaJson.baseURL = util.cleanupURL(util.asURL(process.env.GITANA_PROXY_SCHEME, process.env.GITANA_PROXY_HOST, process.env.GITANA_PROXY_PORT));
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));
217
220
  }
218
221
 
219
222
  // mark as retrieved from virtual driver
@@ -336,7 +339,7 @@ exports = module.exports = function()
336
339
  // defaults
337
340
  if (!configuration.baseURL)
338
341
  {
339
- configuration.baseURL = util.asURL(process.env.GITANA_PROXY_SCHEME, process.env.GITANA_PROXY_HOST, process.env.GITANA_PROXY_PORT);
342
+ configuration.baseURL = util.asURL(process.env.GITANA_PROXY_SCHEME, process.env.GITANA_PROXY_HOST, process.env.GITANA_PROXY_PORT, process.env.GITANA_PROXY_PATH);
340
343
  }
341
344
  if (!configuration.key) {
342
345
  configuration.key = "virtual";
@@ -309,7 +309,7 @@ exports = module.exports = function()
309
309
  req.application(function (err, application) {
310
310
 
311
311
  var loadingPagesCacheKey = application._doc + "-wcm-loading-pages";
312
- _LOCK(null, loadingPagesCacheKey, function (releaseLockFn) {
312
+ _LOCK(null, loadingPagesCacheKey, function (err, releaseLockFn) {
313
313
 
314
314
  // check again inside lock in case another request preloaded this before we arrived
315
315
  req.cache.read(WCM_PAGES, function (err, cachedPages) {
@@ -716,7 +716,7 @@ exports = module.exports = function()
716
716
  var cacheFilePath = cloudcms.toCacheFilePath(pageFilePath);
717
717
 
718
718
  // take out a lock so that only one "request" can write to cache at a time for this path
719
- _LOCK(contentStore, _lock_identifier(pageBasePath), function(releaseLockFn) {
719
+ _LOCK(contentStore, _lock_identifier(pageBasePath), function(err, releaseLockFn) {
720
720
 
721
721
  // write page file
722
722
  contentStore.writeFile(pageFilePath, text, function (err) {
@@ -773,7 +773,7 @@ exports = module.exports = function()
773
773
  var cacheFilePath = cloudcms.toCacheFilePath(pageFilePath);
774
774
 
775
775
  // take out a lock so that only one "request" can read from cache at a time for this path
776
- _LOCK(contentStore, _lock_identifier(pageBasePath), function(releaseLockFn) {
776
+ _LOCK(contentStore, _lock_identifier(pageBasePath), function(err, releaseLockFn) {
777
777
 
778
778
  contentStore.readFile(cacheFilePath, function(err, cacheInfoString) {
779
779
 
@@ -858,7 +858,7 @@ exports = module.exports = function()
858
858
 
859
859
  var _handleCachePageInvalidate = function(contentStore, pageBasePath, callback)
860
860
  {
861
- _LOCK(contentStore, _lock_identifier(pageBasePath), function(releaseLockFn) {
861
+ _LOCK(contentStore, _lock_identifier(pageBasePath), function(err, releaseLockFn) {
862
862
 
863
863
  contentStore.existsDirectory(pageBasePath, function (exists) {
864
864
 
@@ -659,7 +659,7 @@ module.exports = function()
659
659
  var r = {};
660
660
 
661
661
  r.start = function(callback) {
662
-
662
+
663
663
  var config = process.configuration;
664
664
  if (!config["notifications"])
665
665
  {
@@ -686,7 +686,7 @@ module.exports = function()
686
686
  notifications.enabled = true;
687
687
  }
688
688
  }
689
-
689
+
690
690
  if (notifications.enabled)
691
691
  {
692
692
  if (process.env.CLOUDCMS_NOTIFICATIONS_TYPE)