bt-runner 3.2.0 → 3.3.0
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/dist/util/Server.js +10 -1
- package/package.json +1 -1
package/dist/util/Server.js
CHANGED
@@ -50,13 +50,22 @@ class Server {
|
|
50
50
|
app.use("/test", express_1.default.static(this.testFolder));
|
51
51
|
if (this.config.proxies) {
|
52
52
|
const httpproxy = require("express-http-proxy");
|
53
|
-
|
53
|
+
const proxies = this.config.proxies.map((proxy) => this.transformProxy(proxy));
|
54
|
+
for (const proxy of proxies) {
|
54
55
|
app.use(proxy.local, httpproxy(proxy.remote));
|
55
56
|
}
|
56
57
|
}
|
57
58
|
this.server = app.listen(this.port, () => { });
|
58
59
|
return this;
|
59
60
|
}
|
61
|
+
transformProxy(proxy) {
|
62
|
+
if ("remote" in proxy)
|
63
|
+
return proxy;
|
64
|
+
const remoteFromEnv = process.env[proxy.env];
|
65
|
+
if (!remoteFromEnv)
|
66
|
+
throw new Error(`No environment variable found for proxy: ${proxy.env}`);
|
67
|
+
return { local: proxy.local, remote: remoteFromEnv };
|
68
|
+
}
|
60
69
|
stop() {
|
61
70
|
this.server?.close();
|
62
71
|
}
|