mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-08-23 21:50:24 +00:00
Introduce envsubst for config.js, update deps (#3032)
This is the implemenation of envsubst discussed in #1756 Documentation update will follow after merge.
This commit is contained in:
1
tests/configs/port_variable.env
Normal file
1
tests/configs/port_variable.env
Normal file
@@ -0,0 +1 @@
|
||||
MM_PORT=8090
|
13
tests/configs/port_variable.js.template
Normal file
13
tests/configs/port_variable.js.template
Normal file
@@ -0,0 +1,13 @@
|
||||
/* MagicMirror² Test config sample environment set port 8090
|
||||
*
|
||||
* By Rodrigo Ramírez Norambuena https://rodrigoramirez.com
|
||||
* MIT Licensed.
|
||||
*/
|
||||
let config = require(process.cwd() + "/tests/configs/default.js").configFactory({
|
||||
port: ${MM_PORT}
|
||||
});
|
||||
|
||||
/*************** DO NOT EDIT THE LINE BELOW ***************/
|
||||
if (typeof module !== "undefined") {
|
||||
module.exports = config;
|
||||
}
|
15
tests/e2e/template_spec.js
Normal file
15
tests/e2e/template_spec.js
Normal file
@@ -0,0 +1,15 @@
|
||||
const helpers = require("./helpers/global-setup");
|
||||
|
||||
describe("templated config with port variable", () => {
|
||||
beforeAll(async () => {
|
||||
await helpers.startApplication("tests/configs/port_variable.js");
|
||||
});
|
||||
afterAll(async () => {
|
||||
await helpers.stopApplication();
|
||||
});
|
||||
|
||||
it("should return 200", async () => {
|
||||
const res = await helpers.fetch("http://localhost:8090");
|
||||
expect(res.status).toBe(200);
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user