apostrophe 3.39.2 → 3.40.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 +4 -0
- package/index.js +2 -0
- package/package.json +1 -1
- package/test/attachments.js +1 -1
- package/test/base-url-env-var.js +36 -0
package/CHANGELOG.md
CHANGED
package/index.js
CHANGED
|
@@ -449,6 +449,8 @@ async function apostrophe(options, telemetry, rootSpan) {
|
|
|
449
449
|
throw 'Specify the `shortName` option and set it to the name of your project\'s repository or folder';
|
|
450
450
|
}
|
|
451
451
|
self.title = self.options.title;
|
|
452
|
+
// Environment variable override
|
|
453
|
+
self.options.baseUrl = process.env.APOS_BASE_URL || self.options.baseUrl;
|
|
452
454
|
self.baseUrl = self.options.baseUrl;
|
|
453
455
|
self.prefix = self.options.prefix || '';
|
|
454
456
|
}
|
package/package.json
CHANGED
package/test/attachments.js
CHANGED
|
@@ -201,7 +201,7 @@ describe('Attachment', function() {
|
|
|
201
201
|
extension: 'jpg',
|
|
202
202
|
_id: 'test'
|
|
203
203
|
});
|
|
204
|
-
assert(url
|
|
204
|
+
assert.strictEqual(url, '/uploads/attachments/test-test.full.jpg');
|
|
205
205
|
});
|
|
206
206
|
|
|
207
207
|
it('should generate the "one-half" URL when one-half size specified for image', function() {
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
const t = require('../test-lib/test.js');
|
|
2
|
+
const assert = require('assert');
|
|
3
|
+
let apos;
|
|
4
|
+
let savedBaseUrl;
|
|
5
|
+
|
|
6
|
+
const config = {
|
|
7
|
+
root: module,
|
|
8
|
+
// Should get overridden by the above
|
|
9
|
+
baseUrl: 'http://localhost:3000'
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
describe('Locales', function() {
|
|
13
|
+
this.timeout(t.timeout);
|
|
14
|
+
|
|
15
|
+
before(async function() {
|
|
16
|
+
savedBaseUrl = process.env.APOS_BASE_URL;
|
|
17
|
+
process.env.APOS_BASE_URL = 'https://madethisup.com';
|
|
18
|
+
apos = await t.create(config);
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
after(function() {
|
|
22
|
+
if (savedBaseUrl) {
|
|
23
|
+
process.env.APOS_BASE_URL = savedBaseUrl;
|
|
24
|
+
} else {
|
|
25
|
+
delete process.env.APOS_BASE_URL;
|
|
26
|
+
}
|
|
27
|
+
return t.destroy(apos);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it('APOS_BASE_URL should take effect', async function() {
|
|
31
|
+
const req = apos.task.getReq();
|
|
32
|
+
const home = await apos.doc.find(req, { slug: '/' }).toObject();
|
|
33
|
+
assert(home);
|
|
34
|
+
assert.strictEqual(home._url, 'https://madethisup.com/');
|
|
35
|
+
});
|
|
36
|
+
});
|