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 CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.40.0 (2023-02-11)
4
+
5
+ * For devops purposes, the `APOS_BASE_URL` environment variable is now respected as an override of the `baseUrl` option.
6
+
3
7
  ## 3.39.2 (2023-02-03)
4
8
 
5
9
  ### Fixes
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apostrophe",
3
- "version": "3.39.2",
3
+ "version": "3.40.0-alpha",
4
4
  "description": "The Apostrophe Content Management System.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -201,7 +201,7 @@ describe('Attachment', function() {
201
201
  extension: 'jpg',
202
202
  _id: 'test'
203
203
  });
204
- assert(url === '/uploads/attachments/test-test.full.jpg');
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
+ });