mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
chore: Extract specific KubeApi injectables to own package
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
1 parent
84017b48db
commit
a546ae1000
176 files changed
+1366
-1244
No files matched your search
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* 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 assert from "assert";
|
||||
import { storesAndApisCanBeCreatedInjectionToken } from "./can-be-created-token";
|
||||
import { IngressApi } from "@k8slens/kube-api";
|
||||
import { kubeApiInjectionToken } from "./token";
|
||||
import { logErrorInjectionToken, logInfoInjectionToken, logWarningInjectionToken } from "@k8slens/logger";
|
||||
import { maybeKubeApiInjectable } from "./maybe-kube-api.injectable";
|
||||
|
||||
export const ingressApiInjectable = getInjectable({
|
||||
id: "ingress-api",
|
||||
instantiate: (di) => {
|
||||
assert(di.inject(storesAndApisCanBeCreatedInjectionToken), "ingressApi is only available in certain environments");
|
||||
|
||||
return new IngressApi({
|
||||
logError: di.inject(logErrorInjectionToken),
|
||||
logInfo: di.inject(logInfoInjectionToken),
|
||||
logWarn: di.inject(logWarningInjectionToken),
|
||||
maybeKubeApi: di.inject(maybeKubeApiInjectable),
|
||||
});
|
||||
},
|
||||
|
||||
injectionToken: kubeApiInjectionToken,
|
||||
});
|
||||
Reference in new issue
Block a user