cloudcms-server 0.9.301 → 3.2.280
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.
- package/.last_command +7 -0
- package/LICENSE +1 -1
- package/README.md +1 -1
- package/broadcast/providers/redis.js +24 -49
- package/clients/nrp.js +117 -0
- package/clients/redis.js +64 -0
- package/framework/controllers.js +4 -4
- package/index.js +13 -10
- package/insight/insight.js +1 -1
- package/launchpad/index.js +174 -11
- package/launchpad/launchers/cluster.js +103 -110
- package/launchpad/launchers/redis.js +70 -0
- package/launchpad/launchers/single.js +36 -22
- package/locks/locks.js +53 -7
- package/locks/providers/cluster.js +3 -1
- package/locks/providers/memory.js +10 -7
- package/locks/providers/redis.js +62 -82
- package/middleware/admin/admin.js +2 -2
- package/middleware/authentication/adapters/session.js +11 -8
- package/middleware/authentication/authentication.js +28 -16
- package/middleware/authentication/authenticators/default.js +5 -2
- package/middleware/authentication/authenticators/session.js +5 -2
- package/middleware/authentication/providers/saml.js +1 -1
- package/middleware/authorization/authorization.js +11 -8
- package/middleware/awareness/awareness.js +51 -29
- package/middleware/awareness/plugins/editorial.js +4 -4
- package/middleware/awareness/providers/abstract-async.js +107 -84
- package/middleware/awareness/providers/abstract.js +1 -1
- package/middleware/awareness/providers/memory.js +0 -14
- package/middleware/awareness/providers/redis.js +186 -279
- package/middleware/cache/providers/redis.js +127 -89
- package/middleware/cloudcms/cloudcms.js +22 -16
- package/middleware/form/form.js +2 -2
- package/middleware/proxy/proxy.js +7 -21
- package/middleware/stores/stores.js +2 -2
- package/middleware/virtual-config/virtual-config.js +7 -7
- package/middleware/wcm/wcm.js +4 -4
- package/package.json +54 -52
- package/server/index.js +517 -399
- package/server/standalone.js +9 -0
- package/temp/clusterlock/index.js +3 -3
- package/temp/clusterlock/package.json +1 -1
- package/temp/passport-saml/LICENSE +23 -0
- package/temp/passport-saml/README.md +406 -0
- package/temp/passport-saml/lib/node-saml/algorithms.d.ts +5 -0
- package/temp/passport-saml/lib/node-saml/algorithms.js +41 -0
- package/temp/passport-saml/lib/node-saml/algorithms.js.map +1 -0
- package/temp/passport-saml/lib/node-saml/index.d.ts +3 -0
- package/temp/passport-saml/lib/node-saml/index.js +6 -0
- package/temp/passport-saml/lib/node-saml/index.js.map +1 -0
- package/temp/passport-saml/lib/node-saml/inmemory-cache-provider.d.ts +45 -0
- package/temp/passport-saml/lib/node-saml/inmemory-cache-provider.js +86 -0
- package/temp/passport-saml/lib/node-saml/inmemory-cache-provider.js.map +1 -0
- package/temp/passport-saml/lib/node-saml/saml-post-signing.d.ts +3 -0
- package/temp/passport-saml/lib/node-saml/saml-post-signing.js +15 -0
- package/temp/passport-saml/lib/node-saml/saml-post-signing.js.map +1 -0
- package/temp/passport-saml/lib/node-saml/saml.d.ts +77 -0
- package/temp/passport-saml/lib/node-saml/saml.js +1170 -0
- package/temp/passport-saml/lib/node-saml/saml.js.map +1 -0
- package/temp/passport-saml/lib/node-saml/types.d.ts +95 -0
- package/temp/passport-saml/lib/node-saml/types.js +8 -0
- package/temp/passport-saml/lib/node-saml/types.js.map +1 -0
- package/temp/passport-saml/lib/node-saml/utility.d.ts +3 -0
- package/temp/passport-saml/lib/node-saml/utility.js +19 -0
- package/temp/passport-saml/lib/node-saml/utility.js.map +1 -0
- package/temp/passport-saml/lib/node-saml/xml.d.ts +21 -0
- package/temp/passport-saml/lib/node-saml/xml.js +140 -0
- package/temp/passport-saml/lib/node-saml/xml.js.map +1 -0
- package/temp/passport-saml/lib/passport-saml/index.d.ts +6 -0
- package/temp/passport-saml/lib/passport-saml/index.js +11 -0
- package/temp/passport-saml/lib/passport-saml/index.js.map +1 -0
- package/temp/passport-saml/lib/passport-saml/multiSamlStrategy.d.ts +13 -0
- package/temp/passport-saml/lib/passport-saml/multiSamlStrategy.js +63 -0
- package/temp/passport-saml/lib/passport-saml/multiSamlStrategy.js.map +1 -0
- package/temp/passport-saml/lib/passport-saml/strategy.d.ts +20 -0
- package/temp/passport-saml/lib/passport-saml/strategy.js +167 -0
- package/temp/passport-saml/lib/passport-saml/strategy.js.map +1 -0
- package/temp/passport-saml/lib/passport-saml/types.d.ts +51 -0
- package/temp/passport-saml/lib/passport-saml/types.js +11 -0
- package/temp/passport-saml/lib/passport-saml/types.js.map +1 -0
- package/temp/passport-saml/package.json +96 -0
- package/util/auth.js +1 -1
- package/util/cloudcms.js +72 -93
- package/util/proxy-factory.js +230 -260
- package/util/redis.js +113 -0
- package/util/renditions.js +1 -1
- package/util/util.js +15 -2
- package/launchpad/launchers/sticky-cluster.js +0 -43
- package/web/cms/ice.js +0 -109
- package/web/cms/preview.js +0 -106
- package/web/socket.io/socket.io.js +0 -2
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
var
|
|
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 =
|
|
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
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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
|
-
|
|
64
|
-
{
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
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
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
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
|
-
|
|
86
|
-
|
|
87
|
-
|
|
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
|
-
|
|
93
|
-
|
|
92
|
+
|
|
94
93
|
var result = null;
|
|
95
|
-
|
|
94
|
+
try
|
|
96
95
|
{
|
|
97
|
-
|
|
98
|
-
|
|
96
|
+
result = JSON.parse(reply);
|
|
97
|
+
}
|
|
99
98
|
catch (ex)
|
|
100
99
|
{
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
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(
|
|
115
|
-
|
|
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
|
|
123
|
-
|
|
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
|
-
|
|
128
|
-
|
|
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
|
};
|
|
@@ -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
|
|
package/middleware/form/form.js
CHANGED
|
@@ -121,7 +121,7 @@ exports = module.exports = function()
|
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
// post form to Cloud CMS using public method
|
|
124
|
-
var URL = util.asURL(process.env.GITANA_PROXY_SCHEME, process.env.GITANA_PROXY_HOST, process.env.GITANA_PROXY_PORT) + url;
|
|
124
|
+
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;
|
|
125
125
|
|
|
126
126
|
var headers = {};
|
|
127
127
|
headers["Authorization"] = req.gitana.platform().getDriver().getHttpHeaders()["Authorization"];
|
|
@@ -194,7 +194,7 @@ exports = module.exports = function()
|
|
|
194
194
|
|
|
195
195
|
var url = branch.getUri() + "/alpaca/datasource";
|
|
196
196
|
|
|
197
|
-
var URL = util.asURL(process.env.GITANA_PROXY_SCHEME, process.env.GITANA_PROXY_HOST, process.env.GITANA_PROXY_PORT) + url;
|
|
197
|
+
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;
|
|
198
198
|
|
|
199
199
|
var headers = {};
|
|
200
200
|
headers["Authorization"] = req.gitana.platform().getDriver().getHttpHeaders()["Authorization"];
|
|
@@ -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
|
|
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,6 @@ exports = module.exports = function()
|
|
|
215
201
|
contentStore.writeFile(filePath + ".cache", JSON.stringify(cacheInfo), function() {
|
|
216
202
|
_end.call(res, data, encoding);
|
|
217
203
|
});
|
|
218
|
-
|
|
219
204
|
};
|
|
220
205
|
|
|
221
206
|
callback();
|
|
@@ -238,7 +223,7 @@ exports = module.exports = function()
|
|
|
238
223
|
{
|
|
239
224
|
req.url = "/";
|
|
240
225
|
}
|
|
241
|
-
|
|
226
|
+
|
|
242
227
|
// caching scenario
|
|
243
228
|
_handleCacheRead(req, function (err, readStream) {
|
|
244
229
|
|
|
@@ -258,6 +243,7 @@ exports = module.exports = function()
|
|
|
258
243
|
"message": "Missing baseURL from request bound gitana-config"
|
|
259
244
|
});
|
|
260
245
|
}
|
|
246
|
+
|
|
261
247
|
proxyFactory.acquireProxyHandler(proxyTarget, null, function(err, proxyHandler) {
|
|
262
248
|
if (err) {
|
|
263
249
|
return next(err);
|
|
@@ -175,7 +175,7 @@ exports = module.exports = function()
|
|
|
175
175
|
if (!stores) {
|
|
176
176
|
return afterCheck();
|
|
177
177
|
}
|
|
178
|
-
|
|
178
|
+
|
|
179
179
|
return process.cache.read("module-descriptors-" + host, function(err, moduleDescriptorsForHost) {
|
|
180
180
|
|
|
181
181
|
if (err) {
|
|
@@ -481,7 +481,7 @@ exports = module.exports = function()
|
|
|
481
481
|
callback();
|
|
482
482
|
});
|
|
483
483
|
};
|
|
484
|
-
|
|
484
|
+
|
|
485
485
|
process.cache.read("module-descriptors-" + host, function(err, moduleDescriptors) {
|
|
486
486
|
|
|
487
487
|
moduleDescriptors = null;
|
|
@@ -83,7 +83,7 @@ exports = module.exports = function()
|
|
|
83
83
|
|
|
84
84
|
var URL = configuration.virtualDriver.baseURL;
|
|
85
85
|
if (!URL) {
|
|
86
|
-
URL = util.asURL(process.env.GITANA_PROXY_SCHEME, process.env.GITANA_PROXY_HOST, process.env.GITANA_PROXY_PORT);
|
|
86
|
+
URL = util.asURL(process.env.GITANA_PROXY_SCHEME, process.env.GITANA_PROXY_HOST, process.env.GITANA_PROXY_PORT, process.env.GITANA_PROXY_PATH);
|
|
87
87
|
}
|
|
88
88
|
URL += "/virtual/driver/config";
|
|
89
89
|
var requestConfig = {
|
|
@@ -147,10 +147,10 @@ exports = module.exports = function()
|
|
|
147
147
|
}
|
|
148
148
|
};
|
|
149
149
|
|
|
150
|
-
var _LOCK = function(lockKey, workFunction)
|
|
151
|
-
{
|
|
152
|
-
|
|
153
|
-
};
|
|
150
|
+
// var _LOCK = function(lockKey, workFunction)
|
|
151
|
+
// {
|
|
152
|
+
// process.locks.lock(lockKey, workFunction);
|
|
153
|
+
// };
|
|
154
154
|
|
|
155
155
|
var r = {};
|
|
156
156
|
|
|
@@ -217,7 +217,7 @@ exports = module.exports = function()
|
|
|
217
217
|
}
|
|
218
218
|
if (!gitanaJson.baseURL)
|
|
219
219
|
{
|
|
220
|
-
gitanaJson.baseURL = util.cleanupURL(util.asURL(process.env.GITANA_PROXY_SCHEME, process.env.GITANA_PROXY_HOST, process.env.GITANA_PROXY_PORT));
|
|
220
|
+
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));
|
|
221
221
|
}
|
|
222
222
|
|
|
223
223
|
// mark as retrieved from virtual driver
|
|
@@ -340,7 +340,7 @@ exports = module.exports = function()
|
|
|
340
340
|
// defaults
|
|
341
341
|
if (!configuration.baseURL)
|
|
342
342
|
{
|
|
343
|
-
configuration.baseURL = util.asURL(process.env.GITANA_PROXY_SCHEME, process.env.GITANA_PROXY_HOST, process.env.GITANA_PROXY_PORT);
|
|
343
|
+
configuration.baseURL = util.asURL(process.env.GITANA_PROXY_SCHEME, process.env.GITANA_PROXY_HOST, process.env.GITANA_PROXY_PORT, process.env.GITANA_PROXY_PATH);
|
|
344
344
|
}
|
|
345
345
|
if (!configuration.key) {
|
|
346
346
|
configuration.key = "virtual";
|
package/middleware/wcm/wcm.js
CHANGED
|
@@ -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
|
|