diff --git a/src/Dockerfile b/src/Dockerfile new file mode 100644 index 0000000..6c1825f --- /dev/null +++ b/src/Dockerfile @@ -0,0 +1,14 @@ +FROM node:16 + +# Create app directory +WORKDIR /usr/src/app + +# Install app dependencies +COPY package*.json ./ + +RUN npm install +# Bundle app source +COPY . . + +EXPOSE 3000 +CMD [ "npm", "start" ] \ No newline at end of file diff --git a/src/utils/config.ts b/src/utils/config.ts index 0061623..d43d4e3 100644 --- a/src/utils/config.ts +++ b/src/utils/config.ts @@ -1,5 +1,8 @@ const ENV_API_URL: string = 'REACT_APP__API_URL'; - +export const SCRAPER_URL: string = '' + + (process.env['SCAPER_URL'] == null + ? 'http://localhost:8000' + : process.env['SCRAPER_URL']); /** * The value should be: * - When developing frontend only: 'https://coverage.seattlecommunitynetwork.org'. diff --git a/src/vis/MeasurementMap.tsx b/src/vis/MeasurementMap.tsx index d019656..40866f1 100644 --- a/src/vis/MeasurementMap.tsx +++ b/src/vis/MeasurementMap.tsx @@ -1,6 +1,7 @@ import React, { useEffect, useState } from 'react'; import { MapType } from './MapSelectionRadio'; import { API_URL } from '../utils/config'; +import { SCRAPER_URL } from '../utils/config'; import * as L from 'leaflet'; import * as d3 from 'd3'; import * as parser from 'parse-address'; @@ -64,8 +65,7 @@ function searchEventHandler(result: any): void { var postcode = result.location.raw.address.postcode; var state = result.location.raw.address.state; - var endPoint = "http://127.0.0.1:8000/"; // server - var url = endPoint + var url = SCRAPER_URL // server "http://127.0.0.1:8000/" + "?state=" + state + "&cityname=" + city + "&primary=" + parsedAddr.number