@cloud-cli/px 3.5.6 → 3.6.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/index.js +2 -1
- package/dist/proxy-manager.js +7 -2
- package/dist/proxy.d.ts +1 -0
- package/dist/proxy.js +3 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -13,7 +13,7 @@ const manager = new ProxyManager();
|
|
|
13
13
|
async function reload() {
|
|
14
14
|
const targets = await loadTargets();
|
|
15
15
|
px.reset();
|
|
16
|
-
targets.forEach(t => {
|
|
16
|
+
targets.forEach((t) => {
|
|
17
17
|
px.add(new ProxyEntry({
|
|
18
18
|
domain: t.domain,
|
|
19
19
|
target: t.target,
|
|
@@ -21,6 +21,7 @@ async function reload() {
|
|
|
21
21
|
redirectToHttps: t.redirect,
|
|
22
22
|
redirectToUrl: t.redirectUrl,
|
|
23
23
|
cors: t.cors,
|
|
24
|
+
headers: t.headers,
|
|
24
25
|
}));
|
|
25
26
|
});
|
|
26
27
|
px.start();
|
package/dist/proxy-manager.js
CHANGED
|
@@ -19,6 +19,7 @@ export class ProxyManager {
|
|
|
19
19
|
cors: !!proxy.cors,
|
|
20
20
|
redirect: !!proxy.redirect,
|
|
21
21
|
redirectUrl: proxy.redirectUrl || '',
|
|
22
|
+
headers: proxy.headers || '',
|
|
22
23
|
});
|
|
23
24
|
try {
|
|
24
25
|
const id = await entry.save();
|
|
@@ -37,8 +38,9 @@ export class ProxyManager {
|
|
|
37
38
|
const [domain, path = ''] = host.split('/');
|
|
38
39
|
proxies.push(new Proxy({ domain, path }));
|
|
39
40
|
}
|
|
41
|
+
const properties = ['target', 'cors', 'redirect', 'redirectUrl', 'headers'];
|
|
40
42
|
for (const proxy of proxies) {
|
|
41
|
-
|
|
43
|
+
properties.forEach((p) => p in options && (proxy[p] = options[p]));
|
|
42
44
|
await proxy.save();
|
|
43
45
|
}
|
|
44
46
|
return true;
|
|
@@ -74,7 +76,10 @@ export class ProxyManager {
|
|
|
74
76
|
}
|
|
75
77
|
async findByDomainAndPath(string) {
|
|
76
78
|
const [domain, path = ''] = string.split('/');
|
|
77
|
-
const query = new Query().where('domain').is(domain)
|
|
79
|
+
const query = new Query().where('domain').is(domain);
|
|
80
|
+
if (path) {
|
|
81
|
+
query.where('path').is(path);
|
|
82
|
+
}
|
|
78
83
|
const proxies = await Resource.find(Proxy, query);
|
|
79
84
|
return proxies;
|
|
80
85
|
}
|
package/dist/proxy.d.ts
CHANGED
package/dist/proxy.js
CHANGED