1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00
lens/src/main/helm/helm-chart-manager.injectable.ts
Sebastian Malton 4c1e1ac1db Replace use of legacy global execHelm with injectable
Signed-off-by: Sebastian Malton <sebastian@malton.name>
2022-12-06 09:18:58 -05:00

31 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, lifecycleEnum } from "@ogre-tools/injectable";
import type { HelmRepo } from "../../common/helm/helm-repo";
import { HelmChartManager } from "./helm-chart-manager";
import helmChartManagerCacheInjectable from "./helm-chart-manager-cache.injectable";
import loggerInjectable from "../../common/logger.injectable";
import execHelmInjectable from "./exec-helm/exec-helm.injectable";
import readFileInjectable from "../../common/fs/read-file.injectable";
import statInjectable from "../../common/fs/stat/stat.injectable";
const helmChartManagerInjectable = getInjectable({
id: "helm-chart-manager",
instantiate: (di, repo: HelmRepo) => new HelmChartManager({
cache: di.inject(helmChartManagerCacheInjectable),
logger: di.inject(loggerInjectable),
execHelm: di.inject(execHelmInjectable),
readFile: di.inject(readFileInjectable),
stat: di.inject(statInjectable),
}, repo),
lifecycle: lifecycleEnum.keyedSingleton({
getInstanceKey: (di, repo: HelmRepo) => repo.name,
}),
});
export default helmChartManagerInjectable;