mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
- 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>
28 lines
1.1 KiB
TypeScript
28 lines
1.1 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 type { Cluster } from "../../common/cluster/cluster";
|
|
import type { ContextHandlerDependencies } from "./context-handler";
|
|
import { ContextHandler } from "./context-handler";
|
|
import createKubeAuthProxyInjectable from "../kube-auth-proxy/create-kube-auth-proxy.injectable";
|
|
import getKubeAuthProxyCertificateInjectable from "../kube-auth-proxy/get-proxy-cert.injectable";
|
|
|
|
export type CreateContextHandler = (cluster: Cluster) => ContextHandler | undefined;
|
|
|
|
const createContextHandlerInjectable = getInjectable({
|
|
id: "create-context-handler",
|
|
|
|
instantiate: (di): CreateContextHandler => {
|
|
const dependencies: ContextHandlerDependencies = {
|
|
createKubeAuthProxy: di.inject(createKubeAuthProxyInjectable),
|
|
getKubeAuthProxyCertificate: di.inject(getKubeAuthProxyCertificateInjectable),
|
|
};
|
|
|
|
return (cluster) => new ContextHandler(dependencies, cluster);
|
|
},
|
|
});
|
|
|
|
export default createContextHandlerInjectable;
|