Make n8n work with new version of convict

This commit is contained in:
Jan Oberhauser 2021-03-25 11:17:30 +01:00
parent bed5195eb8
commit 5f96f01f24

View file

@ -95,14 +95,14 @@ export async function getConfigValue(configKey: string): Promise<string | boolea
// Get the environment variable // Get the environment variable
const configSchema = config.getSchema(); const configSchema = config.getSchema();
let currentSchema = configSchema.properties as IDataObject; let currentSchema = configSchema._cvtProperties as IDataObject;
for (const key of configKeyParts) { for (const key of configKeyParts) {
if (currentSchema[key] === undefined) { if (currentSchema[key] === undefined) {
throw new Error(`Key "${key}" of ConfigKey "${configKey}" does not exist`); throw new Error(`Key "${key}" of ConfigKey "${configKey}" does not exist`);
} else if ((currentSchema[key]! as IDataObject).properties === undefined) { } else if ((currentSchema[key]! as IDataObject)._cvtProperties === undefined) {
currentSchema = currentSchema[key] as IDataObject; currentSchema = currentSchema[key] as IDataObject;
} else { } else {
currentSchema = (currentSchema[key] as IDataObject).properties as IDataObject; currentSchema = (currentSchema[key] as IDataObject)._cvtProperties as IDataObject;
} }
} }