From 2a4ab13679dd903b5666670b41d7787cd30cbadf Mon Sep 17 00:00:00 2001 From: Nawafds <60396177+Nawafds@users.noreply.github.com> Date: Wed, 6 Dec 2023 14:47:59 -0500 Subject: [PATCH] env stuff --- .gitignore | 1 + rssfeed/package-lock.json | 31 ++++++++++++++++++++++++++++++ rssfeed/package.json | 2 ++ rssfeed/rss_feed_simple_version.js | 10 ++++++---- 4 files changed, 40 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index b5495d9..e1f901a 100644 --- a/.gitignore +++ b/.gitignore @@ -183,3 +183,4 @@ cloud_functions/functions/scripts/JSON_data/naacpdata.json cloud_functions/functions/scripts/JSON_data/new_naacp.json cloud_functions/functions/config.js MongoDB/src/JSON_data/census.json +rssfeed/.env \ No newline at end of file diff --git a/rssfeed/package-lock.json b/rssfeed/package-lock.json index 2684b5f..9eca0f9 100644 --- a/rssfeed/package-lock.json +++ b/rssfeed/package-lock.json @@ -12,6 +12,8 @@ "axios": "^1.6.2", "cheerio": "^1.0.0-rc.12", "crypto": "^1.0.1", + "dotenv": "^16.3.1", + "env": "^0.0.2", "jquery": "^3.7.1", "js-sha256": "^0.10.1", "mongodb": "^6.3.0", @@ -206,6 +208,17 @@ "url": "https://github.com/fb55/domutils?sponsor=1" } }, + "node_modules/dotenv": { + "version": "16.3.1", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.3.1.tgz", + "integrity": "sha512-IPzF4w4/Rd94bA9imS68tZBaYyBWSCE47V1RGuMrB94iyTOIEwRmVL2x/4An+6mETpLrKJ5hQkB8W4kFAadeIQ==", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/motdotla/dotenv?sponsor=1" + } + }, "node_modules/entities": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", @@ -217,6 +230,14 @@ "url": "https://github.com/fb55/entities?sponsor=1" } }, + "node_modules/env": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/env/-/env-0.0.2.tgz", + "integrity": "sha512-yP8LfjO4ughSHD/3HgLPinWzexmaOGvRfs2TFx0SZhOm7j1xPi9evjuGcLiNVHIGLmcsgMak4eDbBzlYqGIVxw==", + "engines": { + "node": ">= 0.5.9" + } + }, "node_modules/follow-redirects": { "version": "1.15.3", "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.3.tgz", @@ -608,11 +629,21 @@ "domhandler": "^5.0.3" } }, + "dotenv": { + "version": "16.3.1", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.3.1.tgz", + "integrity": "sha512-IPzF4w4/Rd94bA9imS68tZBaYyBWSCE47V1RGuMrB94iyTOIEwRmVL2x/4An+6mETpLrKJ5hQkB8W4kFAadeIQ==" + }, "entities": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==" }, + "env": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/env/-/env-0.0.2.tgz", + "integrity": "sha512-yP8LfjO4ughSHD/3HgLPinWzexmaOGvRfs2TFx0SZhOm7j1xPi9evjuGcLiNVHIGLmcsgMak4eDbBzlYqGIVxw==" + }, "follow-redirects": { "version": "1.15.3", "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.3.tgz", diff --git a/rssfeed/package.json b/rssfeed/package.json index 85b8000..27e6fa5 100644 --- a/rssfeed/package.json +++ b/rssfeed/package.json @@ -13,6 +13,8 @@ "axios": "^1.6.2", "cheerio": "^1.0.0-rc.12", "crypto": "^1.0.1", + "dotenv": "^16.3.1", + "env": "^0.0.2", "jquery": "^3.7.1", "js-sha256": "^0.10.1", "mongodb": "^6.3.0", diff --git a/rssfeed/rss_feed_simple_version.js b/rssfeed/rss_feed_simple_version.js index b8594d8..1ac3da7 100644 --- a/rssfeed/rss_feed_simple_version.js +++ b/rssfeed/rss_feed_simple_version.js @@ -1,16 +1,18 @@ const axios = require("axios"); const cheerio = require("cheerio"); const cron = require("node-cron"); +require("dotenv").config(); const papa = require("papaparse"); const sha256 = require("js-sha256"); const { MongoClient } = require("mongodb"); -const mongoUrl = - "mongodb://mongo:UTwpvdTfzaWxGt29evbw@containers-us-west-177.railway.app:6703"; +const mongoUrl = process.env.REACT_SCRAPPER_MONGO; +const proxy_Url = process.env.REACT_APP_ML_PIP_URL; + +console.log(mongoUrl); const dbName = "se_naacp_db"; -const proxy_Url = "https://ml-service-toswle5frq-ue.a.run.app/upload_csv"; async function get_links() { const client = new MongoClient(mongoUrl); @@ -173,7 +175,7 @@ function logMessage() { console.log("Cron job executed at:", new Date().toLocaleString()); } -cron.schedule("* * * * *", async () => { +cron.schedule("20 * * * * *", async () => { logMessage(); await main(); });