apostrophe 2.224.0 → 2.225.0-alpha
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/CHANGELOG.md +6 -0
- package/index.js +2 -0
- package/package.json +1 -1
- package/test/base-url-env-var.js +45 -0
package/CHANGELOG.md
CHANGED
package/index.js
CHANGED
|
@@ -335,6 +335,8 @@ module.exports = function(options) {
|
|
|
335
335
|
throw "Specify the `shortName` option and set it to the name of your project's repository or folder";
|
|
336
336
|
}
|
|
337
337
|
self.title = self.options.title;
|
|
338
|
+
// For devops purposes
|
|
339
|
+
self.options.baseUrl = process.env.APOS_BASE_URL || self.options.baseUrl;
|
|
338
340
|
self.baseUrl = self.options.baseUrl;
|
|
339
341
|
self.prefix = self.options.prefix || '';
|
|
340
342
|
}
|
package/package.json
CHANGED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
const t = require('../test-lib/test.js');
|
|
2
|
+
const assert = require('assert');
|
|
3
|
+
let apos;
|
|
4
|
+
let savedBaseUrl;
|
|
5
|
+
|
|
6
|
+
describe('APOS_BASE_URL environment variable', function() {
|
|
7
|
+
|
|
8
|
+
this.timeout(t.timeout);
|
|
9
|
+
|
|
10
|
+
before(function(done) {
|
|
11
|
+
savedBaseUrl = process.env.APOS_BASE_URL;
|
|
12
|
+
process.env.APOS_BASE_URL = 'https://madethisup.com';
|
|
13
|
+
apos = require('../index.js')({
|
|
14
|
+
root: module,
|
|
15
|
+
shortName: 'test',
|
|
16
|
+
afterInit: function(callback) {
|
|
17
|
+
// In tests this will be the name of the test file,
|
|
18
|
+
// so override that in order to get apostrophe to
|
|
19
|
+
// listen normally and not try to run a task. -Tom
|
|
20
|
+
apos.argv._ = [];
|
|
21
|
+
return callback(null);
|
|
22
|
+
},
|
|
23
|
+
afterListen: function(err) {
|
|
24
|
+
assert(!err);
|
|
25
|
+
done();
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
after(function(done) {
|
|
31
|
+
if (savedBaseUrl) {
|
|
32
|
+
process.env.APOS_BASE_URL = savedBaseUrl;
|
|
33
|
+
} else {
|
|
34
|
+
delete process.env.APOS_BASE_URL;
|
|
35
|
+
}
|
|
36
|
+
return t.destroy(apos, done);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it('should respect APOS_BASE_URL', async function() {
|
|
40
|
+
const req = apos.tasks.getReq();
|
|
41
|
+
const home = await apos.docs.find(req, { slug: '/' }).toObject();
|
|
42
|
+
assert(home);
|
|
43
|
+
assert.strictEqual(home._url, 'https://madethisup.com/');
|
|
44
|
+
});
|
|
45
|
+
});
|