safer env vars in dbmodel connection

This commit is contained in:
Jan Prochazka
2024-10-01 12:17:25 +02:00
parent ef5e30df3d
commit d61b5e135f

View File

@@ -37,8 +37,8 @@ async function loadConnection(driver, storedConnection, connectionMode) {
if (allowConnectionFromEnvVariables) {
return _.mapValues(storedConnection, (value, key) => {
if (_.isString(value) && value.startsWith('$')) {
return process.env[value.substring(1)];
if (_.isString(value) && value.startsWith('${') && value.endsWith('}')) {
return process.env[value.slice(2, -1)];
}
return value;
});