From 37d856504d720973181528fc5503045e1bc16164 Mon Sep 17 00:00:00 2001 From: msramalho <19508417+msramalho@users.noreply.github.com> Date: Mon, 27 Feb 2023 12:01:01 +0100 Subject: [PATCH] improving package.json with api endpoint info dev/prod --- package.json | 2 +- source/js/background.js | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index fc914f4..377c295 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "private": true, "scripts": { - "build": "rm -rf distribution && rm -f distribution.zip && parcel build source/manifest.json --no-content-hash --no-source-maps --dist-dir distribution --no-cache --detailed-report 0 && zip -r distribution.zip distribution", + "build": "rm -rf distribution && rm -f distribution.zip && API_ENDPOINT=http://134.122.58.133:8004/tasks parcel build source/manifest.json --no-content-hash --no-source-maps --dist-dir distribution --no-cache --detailed-report 0 && zip -r distribution.zip distribution", "lint": "run-p lint:*", "lint-fix": "run-p 'lint:* -- --fix'", "lint:css": "stylelint source/**/*.css", diff --git a/source/js/background.js b/source/js/background.js index c98c1a0..5dc853d 100644 --- a/source/js/background.js +++ b/source/js/background.js @@ -3,9 +3,10 @@ import optionsStorage from './options-storage.js'; import { getReasonPhrase } from 'http-status-codes'; -// TODO: stable ID https://developer.chrome.com/docs/extensions/mv3/tut_oauth/ -// const API_ENDPOINT = 'http://localhost:8004/tasks' -const API_ENDPOINT = 'http://134.122.58.133:8004/tasks'; +// const API_ENDPOINT = process.env.API_ENDPOINT || 'http://134.122.58.133:8004/tasks'; +const API_ENDPOINT = process.env.API_ENDPOINT || 'http://localhost:8004/tasks'; + +console.log(`using API_ENDPOINT=${API_ENDPOINT}`) const LOGIN_FAILED = `Could not login, make sure your google account email has been granted access by the developers.`;