Clean up versioning and packageJson uses (#6196)

This commit is contained in:
Sebastian Malton authored and GitHub committed 2022-09-15 17:20:58 -04:00
1 parent cfe35ded90
commit 67ac1692b2
116 files changed
+1154 -644

No files matched your search

+10 -16
View File
@@ -10,26 +10,20 @@ import httpProxy from "http-proxy";
import clusterManagerInjectable from "../cluster-manager.injectable";
import shellApiRequestInjectable from "./proxy-functions/shell-api-request/shell-api-request.injectable";
import lensProxyPortInjectable from "./lens-proxy-port.injectable";
import contentSecurityPolicyInjectable from "../../common/vars/content-security-policy.injectable";
const lensProxyInjectable = getInjectable({
id: "lens-proxy",
instantiate: (di) => {
const clusterManager = di.inject(clusterManagerInjectable);
const router = di.inject(routerInjectable);
const shellApiRequest = di.inject(shellApiRequestInjectable);
const proxy = httpProxy.createProxy();
const lensProxyPort = di.inject(lensProxyPortInjectable);
return new LensProxy({
router,
proxy,
kubeApiUpgradeRequest,
shellApiRequest,
getClusterForRequest: clusterManager.getClusterForRequest,
lensProxyPort,
});
},
instantiate: (di) => new LensProxy({
router: di.inject(routerInjectable),
proxy: httpProxy.createProxy(),
kubeApiUpgradeRequest,
shellApiRequest: di.inject(shellApiRequestInjectable),
getClusterForRequest: di.inject(clusterManagerInjectable).getClusterForRequest,
lensProxyPort: di.inject(lensProxyPortInjectable),
contentSecurityPolicy: di.inject(contentSecurityPolicyInjectable),
}),
});
export default lensProxyInjectable;
+7 -9
View File
@@ -7,7 +7,7 @@ import net from "net";
import type http from "http";
import spdy from "spdy";
import type httpProxy from "http-proxy";
import { apiPrefix, apiKubePrefix, contentSecurityPolicy } from "../../common/vars";
import { apiPrefix, apiKubePrefix } from "../../common/vars";
import type { Router } from "../router/router";
import type { ClusterContextHandler } from "../context-handler/context-handler";
import logger from "../logger";
@@ -26,9 +26,10 @@ interface Dependencies {
getClusterForRequest: GetClusterForRequest;
shellApiRequest: (args: ProxyApiRequestArgs) => void | Promise<void>;
kubeApiUpgradeRequest: (args: ProxyApiRequestArgs) => void | Promise<void>;
router: Router;
proxy: httpProxy;
lensProxyPort: { set: (portNumber: number) => void };
readonly router: Router;
readonly proxy: httpProxy;
readonly lensProxyPort: { set: (portNumber: number) => void };
readonly contentSecurityPolicy: string;
}
const watchParam = "watch";
@@ -63,7 +64,7 @@ export class LensProxy {
protected closed = false;
protected retryCounters = new Map<string, number>();
constructor(private dependencies: Dependencies) {
constructor(private readonly dependencies: Dependencies) {
this.configureProxy(dependencies.proxy);
this.proxyServer = spdy.createServer({
@@ -239,10 +240,7 @@ export class LensProxy {
}
}
if (contentSecurityPolicy) {
res.setHeader("Content-Security-Policy", contentSecurityPolicy);
}
res.setHeader("Content-Security-Policy", this.dependencies.contentSecurityPolicy);
this.dependencies.router.route(cluster, req, res);
}
}