@cloud-cli/px 4.2.4 → 4.2.6

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.
@@ -150,19 +150,22 @@ export class ProxyManager {
150
150
  }
151
151
  }
152
152
  function readProxyFromContainer(c) {
153
+ const domain = [c.labels.host, c.labels.path].join("/");
154
+ const proxyOverrides = get(domain) || {};
153
155
  return {
154
- domain: [c.labels.host, c.labels.path].join("/"),
155
- target: `http://localhost:${c.ports[0].host}`,
156
156
  redirect: true,
157
157
  redirectUrl: "",
158
158
  cors: true,
159
159
  authorization: "",
160
160
  preserveHost: false,
161
161
  headers: "",
162
+ ...proxyOverrides,
163
+ domain,
164
+ target: `http://localhost:${c.ports[0].host}`,
162
165
  };
163
166
  }
164
167
  function readDockerContainer(d) {
165
- const labels = Object.fromEntries(Object.entries(d.Config.Labels)
168
+ const labels = Object.fromEntries(Object.entries(d.Config.Labels || {})
166
169
  .filter(([key]) => key.startsWith("px:"))
167
170
  .map(([key, value]) => [key.replace("px:", ""), value]));
168
171
  return {
@@ -171,7 +174,7 @@ function readDockerContainer(d) {
171
174
  state: d.State.Status,
172
175
  name: d.Name,
173
176
  labels: labels,
174
- ports: Object.entries(d.HostConfig.PortBindings).map(([port, pb]) => ({
177
+ ports: Object.entries(d.HostConfig.PortBindings || {}).map(([port, pb]) => ({
175
178
  container: Number(port.replace(/\D+/, "")),
176
179
  host: Number(pb[0].HostPort),
177
180
  })),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloud-cli/px",
3
- "version": "4.2.4",
3
+ "version": "4.2.6",
4
4
  "description": "Reverse Proxy",
5
5
  "main": "./dist/index.js",
6
6
  "type": "module",