in env/secrets/src/secrets.lib.ts [123:157]
public static async checkEnv(env: Record<string, string>, sysenv, warn = true): boolean {
let result = true;
try {
const output = await Secrets.runOps('-config -d');
const lines = String(output).split("\n");
const opsKeys: string[] = [];
// build the array of local configuration
for (const line of lines) {
if (line.indexOf("=") > -1) {
const lineItems = line.split("=");
if (lineItems[0])
opsKeys.push(lineItems[0]);
}
}
// check if each env is in local configuration
for (const envKey in env) {
if (!opsKeys.includes(envKey)) {
//console.log(envKey);
// we missed this in local config
result = false;
break;
}
}
if (!result) {
if (warn) console.log('WARNING: Your local env is out of sync. Repeat ops -login to sync.');
return false;
}
return true;
} catch (err) {
console.log(err);
return false;
}
}