38 lines
1.3 KiB
TypeScript
38 lines
1.3 KiB
TypeScript
import type { Cloudly } from '../cloudly.classes.cloudly.js';
|
|
|
|
export const installDemoData = async (cloudlyRef: Cloudly) => {
|
|
|
|
// ================================================================================
|
|
// SECRETS
|
|
|
|
const demoDataSecrets = await import('./demo.data.secrets.js');
|
|
|
|
const secretGroups = await cloudlyRef.secretManager.CSecretGroup.getInstances({});
|
|
for (const secretGroup of secretGroups) {
|
|
await secretGroup.delete();
|
|
}
|
|
|
|
const secretBundles = await cloudlyRef.secretManager.CSecretBundle.getInstances({});
|
|
for (const secretBundle of secretBundles) {
|
|
await secretBundle.delete();
|
|
}
|
|
|
|
for (const secretData of demoDataSecrets.demoSecretGroups) {
|
|
const secretGroup = new cloudlyRef.secretManager.CSecretGroup();
|
|
Object.assign(secretGroup, secretData);
|
|
await secretGroup.save();
|
|
}
|
|
for (const secretBundleData of demoDataSecrets.demoConfigBundles) {
|
|
const secretBundle = new cloudlyRef.secretManager.CSecretBundle();
|
|
Object.assign(secretBundle, secretBundleData);
|
|
await secretBundle.save();
|
|
}
|
|
|
|
// ================================================================================
|
|
// CLUSTERS
|
|
const clusters = await cloudlyRef.clusterManager.CCluster.getInstances({});
|
|
for (const cluster of clusters) {
|
|
await cluster.delete();
|
|
}
|
|
|
|
} |