mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Kubeconfigs as file references (#466)
Signed-off-by: Jussi Nummelin <jussi.nummelin@gmail.com> Co-authored-by: Lauri Nevala <lauri.nevala@gmail.com> Co-authored-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
23 files changed
+272
-162
No files matched your search
@@ -0,0 +1,16 @@
|
||||
import { app, remote } from "electron"
|
||||
import { ensureDirSync, writeFileSync } from "fs-extra"
|
||||
import * as path from "path"
|
||||
|
||||
// Writes kubeconfigs to "embedded" store, i.e. .../Lens/kubeconfigs/
|
||||
export function writeEmbeddedKubeConfig(clusterId: string, kubeConfig: string): string {
|
||||
// This can be called from main & renderer
|
||||
const a = (app || remote.app)
|
||||
const kubeConfigBase = path.join(a.getPath("userData"), "kubeconfigs")
|
||||
ensureDirSync(kubeConfigBase)
|
||||
|
||||
const kubeConfigFile = path.join(kubeConfigBase, clusterId)
|
||||
writeFileSync(kubeConfigFile, kubeConfig)
|
||||
|
||||
return kubeConfigFile
|
||||
}
|
||||
Reference in new issue
Block a user