Skip to content

Commit

Permalink
fix(import-posts): use WHYD_URL_PREFIX env var
Browse files Browse the repository at this point in the history
  • Loading branch information
adrienjoly committed Jan 4, 2024
1 parent 50fa788 commit caa0816
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
1 change: 0 additions & 1 deletion 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"
6 changes: 3 additions & 3 deletions scripts/import-posts.js
Expand Up @@ -27,7 +27,7 @@ assert.ok(

// Environment
const {
URL_PREFIX,
WHYD_URL_PREFIX,
MONGODB_HOST,
MONGODB_PORT,
MONGODB_DATABASE,
Expand All @@ -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)),
Expand All @@ -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
Expand Down

0 comments on commit caa0816

Please sign in to comment.