From caa08163a389e4fe33be575f0064598e89f2400a Mon Sep 17 00:00:00 2001 From: Adrien Joly <531781+adrienjoly@users.noreply.github.com> Date: Thu, 4 Jan 2024 20:01:14 +0100 Subject: [PATCH] fix(import-posts): use WHYD_URL_PREFIX env var --- env-vars-testing-local.sh | 1 - scripts/import-posts.js | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/env-vars-testing-local.sh b/env-vars-testing-local.sh index ab10e403..a75d3872 100755 --- a/env-vars-testing-local.sh +++ b/env-vars-testing-local.sh @@ -1,4 +1,3 @@ . ./env-vars-testing.sh . ./.env-local # helpful to store secrets, e.g. credentials for auth0 development tenant export MONGODB_PORT=27117 -export URL_PREFIX="http://localhost:8080" diff --git a/scripts/import-posts.js b/scripts/import-posts.js index 1f4e7311..d7cb9a2e 100644 --- a/scripts/import-posts.js +++ b/scripts/import-posts.js @@ -27,7 +27,7 @@ assert.ok( // Environment const { - URL_PREFIX, + WHYD_URL_PREFIX, MONGODB_HOST, MONGODB_PORT, MONGODB_DATABASE, @@ -51,7 +51,7 @@ const connectToDb = ({ url, dbName }) => { const fetchUserProfile = ({ userId }) => new Promise((resolve, reject) => { - const url = `${URL_PREFIX}/api/user/${userId}?format=json`; + const url = `${WHYD_URL_PREFIX}/api/user/${userId}?format=json`; console.warn(`fetching profile from ${url} ...`); request(url, (err, _, body) => err ? reject(err) : resolve(JSON.parse(body)), @@ -69,7 +69,7 @@ const updateUser = ({ db, user }) => { const fetchUserPosts = ({ userId }) => new Promise((resolve, reject) => { const limit = 99999999; - const url = `${URL_PREFIX}/u/${userId}?format=json&limit=${limit}`; + const url = `${WHYD_URL_PREFIX}/u/${userId}?format=json&limit=${limit}`; console.warn(`fetching posts from ${url} ...`); request(url, (err, _, body) => err