diff --git a/functions/.env.dev b/functions/.env.dev new file mode 100644 index 00000000..b5aae225 --- /dev/null +++ b/functions/.env.dev @@ -0,0 +1,3 @@ +# This sets which EnvConfig is deployed to Firebase Cloud Functions + +NEXT_PUBLIC_FIREBASE_ENV=DEV diff --git a/functions/.env b/functions/.env.prod similarity index 100% rename from functions/.env rename to functions/.env.prod diff --git a/functions/package.json b/functions/package.json index 0397c5db..cd2a9ec5 100644 --- a/functions/package.json +++ b/functions/package.json @@ -5,7 +5,7 @@ "firestore": "dev-mantic-markets.appspot.com" }, "scripts": { - "build": "yarn compile && rm -rf dist && mkdir -p dist/functions && cp -R ../common/lib dist/common && cp -R lib/src dist/functions/src && cp ../yarn.lock dist && cp package.json dist && cp .env dist", + "build": "yarn compile && rm -rf dist && mkdir -p dist/functions && cp -R ../common/lib dist/common && cp -R lib/src dist/functions/src && cp ../yarn.lock dist && cp package.json dist && cp .env.prod dist && cp .env.dev dist", "compile": "tsc -b", "watch": "tsc -w", "shell": "yarn build && firebase functions:shell", diff --git a/functions/src/update-metrics.ts b/functions/src/update-metrics.ts index 39faadbf..5dfb1eeb 100644 --- a/functions/src/update-metrics.ts +++ b/functions/src/update-metrics.ts @@ -30,7 +30,9 @@ const firestore = admin.firestore() export const scheduleUpdateMetrics = functions.pubsub .schedule('every 15 minutes') .onRun(async () => { - const response = await fetch(getFunctionUrl('updatemetrics'), { + const url = getFunctionUrl('updatemetrics') + console.log('Scheduling update metrics', url) + const response = await fetch(url, { headers: { 'Content-Type': 'application/json', },