From eaa20d18f0351dc64364f43ce477af45b46acc89 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Fri, 29 Jan 2021 23:04:52 +0100 Subject: [PATCH] scripts: use db from connection string. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- src/assets/configs-aws | 2 +- src/scripts/deleteChargingStations.js | 4 ++-- src/scripts/setCSPublicFlag.js | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/assets/configs-aws b/src/assets/configs-aws index 5c1897ea..03f3aba6 160000 --- a/src/assets/configs-aws +++ b/src/assets/configs-aws @@ -1 +1 @@ -Subproject commit 5c1897ea8127c73f6e063c2267214089719da194 +Subproject commit 03f3aba699def4fdfc3926674e469aef37e444d9 diff --git a/src/scripts/deleteChargingStations.js b/src/scripts/deleteChargingStations.js index 2e84eeba..0dbefc07 100755 --- a/src/scripts/deleteChargingStations.js +++ b/src/scripts/deleteChargingStations.js @@ -13,12 +13,12 @@ const fs = require('fs'); const config = JSON.parse(fs.readFileSync('scriptConfig.json', 'utf8')); // Mongo Connection and Query -if (config?.mongoConnectionString) { +if (config && config.mongoConnectionString) { MongoClient.connect(config.mongoConnectionString, { useUnifiedTopology: true, useNewUrlParser: true }, async function(err, client) { - const db = client.db('evse'); + const db = client.db(); for await (const tenantID of config.tenantIDs) { const response = await db.collection(tenantID + '.chargingstations').deleteMany( diff --git a/src/scripts/setCSPublicFlag.js b/src/scripts/setCSPublicFlag.js index 3ecf5089..06502374 100755 --- a/src/scripts/setCSPublicFlag.js +++ b/src/scripts/setCSPublicFlag.js @@ -14,12 +14,12 @@ const fs = require('fs'); const config = JSON.parse(fs.readFileSync('scriptConfig.json', 'utf8')); // Mongo Connection and Query -if (config?.mongoConnectionString) { +if (config && config.mongoConnectionString) { MongoClient.connect(config.mongoConnectionString, { useUnifiedTopology: true, useNewUrlParser: true }, async function(err, client) { - const db = client.db('evse'); + const db = client.db(); for await (const tenantID of config.tenantIDs) { const response = await db.collection(tenantID + '.chargingstations').updateMany( -- 2.34.1