From 1f39143ceff067e53fc2a0a10622e808b581413e Mon Sep 17 00:00:00 2001 From: migudel <miguel.moras@estudiantes.uva.es> Date: Wed, 25 Dec 2024 13:41:12 +0100 Subject: [PATCH] =?UTF-8?q?Mejora=20sobre=20el=20poblador,=20modos=20depur?= =?UTF-8?q?aci=C3=B3n=20y=20forzado,=20parada=20segura=20si=20ya=20hay=20d?= =?UTF-8?q?atos?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- poblate/index.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/poblate/index.js b/poblate/index.js index f144d24..1a3b339 100644 --- a/poblate/index.js +++ b/poblate/index.js @@ -5,10 +5,11 @@ const { jwtDecode } = require("jwt-decode"); const dev = require("./environments/env"); const prod = require("./environments/env.production"); -// Modo +// Environments consts const args = process.argv; const isProduction = args.includes("--prod"); -const DEBUG = args.includes("--debug"); +const DEBUG = args.includes("--debug") || args.includes("-d"); +const FORCE = args.includes("--force") || args.includes("-f"); const env = (isProduction ? prod : dev).env; const { authApi, hotelsApi, bookingsApi } = env; @@ -59,6 +60,10 @@ const savePost = async (data, first, second = "") => { return await axios.post(first, data); } catch (error) { console.error("ERROR Al REGISTRO, SE PROCEDE A INTENTAR ACCEDER"); + if (!FORCE) { + console.log("Parece que ya hay datos en el sistema"); + process.exit(0); + } return await axios.post(second, data); } } catch (error) { -- GitLab