1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00
lens/src/main/lens-proxy/proxy.injectable.ts
Sebastian Malton 50562f4eef Convert some non-store Singletons to normal injectables
- ClusterManager
- KubeconfigSyncManager
- LensProxy
- WindowManager

Other work:
- Convert logger to be an injection token, add createChildLogger to
  abstract away the need for logPrefix
- Fix tests

Signed-off-by: Sebastian Malton <sebastian@malton.name>
2022-05-04 14:52:11 -04:00

29 lines
1.2 KiB
TypeScript

/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import { getInjectable } from "@ogre-tools/injectable";
import httpProxy from "http-proxy";
import getClusterForRequestInjectable from "../cluster/get-cluster-for-request.injectable";
import routerInjectable from "../router/router.injectable";
import { kubeApiUpgradeRequest } from "./kube-api-upgrade-request";
import { LensProxy } from "./lens-proxy";
import lensProxyLoggerInjectable from "./logger.injectable";
import lensProxyPortInjectable from "./port.injectable";
import shellApiRequestHandlerInjectable from "./shell-api/handler.injectable";
const lensProxyInjectable = getInjectable({
id: "lens-proxy",
instantiate: (di) => new LensProxy({
getClusterForRequest: di.inject(getClusterForRequestInjectable),
kubeApiUpgradeRequest,
logger: di.inject(lensProxyLoggerInjectable),
proxy: httpProxy.createProxy(),
proxyPort: di.inject(lensProxyPortInjectable),
router: di.inject(routerInjectable),
shellApiRequest: di.inject(shellApiRequestHandlerInjectable),
}),
});
export default lensProxyInjectable;