mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
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>
17 lines
601 B
TypeScript
17 lines
601 B
TypeScript
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
|
|
}
|