From 12f27b83072e9c9d607b75ee7aea5b8aefd4f953 Mon Sep 17 00:00:00 2001 From: Fedor Katurov Date: Thu, 30 Nov 2023 16:03:45 +0700 Subject: [PATCH 1/4] debug REACT_APP_API_ADDR --- .env.example | 4 ++-- src/config/frontend.ts | 9 ++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.env.example b/.env.example index 0cd2ce7..0c12873 100644 --- a/.env.example +++ b/.env.example @@ -1,4 +1,4 @@ -REACT_APP_PUBLIC_PATH = https://alpha-map.vault48.org/ -REACT_APP_API_ADDR = https://alpha-map.vault48.org:3001 +REACT_APP_PUBLIC_PATH = https://map.vault48.org/ +REACT_APP_API_ADDR = https://backend.map.vault48.org REACT_APP_OSRM_URL = https://vault48.org:5001/route/v1 REACT_APP_OSRM_PROFILE = bike diff --git a/src/config/frontend.ts b/src/config/frontend.ts index c498a40..bc96649 100644 --- a/src/config/frontend.ts +++ b/src/config/frontend.ts @@ -5,9 +5,12 @@ const PUBLIC_PATH = process.env.REACT_APP_PUBLIC_PATH || ''; const API_ADDR = process.env.REACT_APP_API_ADDR || ''; const OSRM_URL = process.env.REACT_APP_OSRM_URL || ''; const OSRM_PROFILE = process.env.REACT_APP_OSRM_PROFILE || 'bike'; -const OSRM_TEST_URL = ([south_west, north_east]: LatLngLiteral[]) => ( - `${OSRM_URL}/${OSRM_PROFILE}/${Object.values(south_west).join(',')};${Object.values(north_east).join(',')}` -); +const OSRM_TEST_URL = ([south_west, north_east]: LatLngLiteral[]) => + `${OSRM_URL}/${OSRM_PROFILE}/${Object.values(south_west).join(',')};${Object.values( + north_east + ).join(',')}`; + +console.log('its', process.env.REACT_APP_API_ADDR); export const CLIENT = { OSRM_URL, From 49a20155105bb2990049d93334c5ac1fcaf14d5b Mon Sep 17 00:00:00 2001 From: Fedor Katurov Date: Thu, 30 Nov 2023 16:05:51 +0700 Subject: [PATCH 2/4] pass additional args on a build stage --- docker/www/Dockerfile | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/docker/www/Dockerfile b/docker/www/Dockerfile index 30177f6..0c348e7 100644 --- a/docker/www/Dockerfile +++ b/docker/www/Dockerfile @@ -1,11 +1,26 @@ # stage1 as builder FROM node:erbium-alpine as builder + COPY package.json yarn.lock ./ + RUN yarn + COPY . . + +ARG REACT_APP_PUBLIC_PATH +ARG REACT_APP_API_ADDR +ARG REACT_APP_OSRM_URL +ARG REACT_APP_OSRM_PROFILE + +ENV REACT_APP_PUBLIC_PATH $REACT_APP_PUBLIC_PATH +ENV REACT_APP_API_ADDR $REACT_APP_API_ADDR +ENV REACT_APP_OSRM_URL $REACT_APP_OSRM_URL +ENV REACT_APP_OSRM_PROFILE $REACT_APP_OSRM_PROFILE + RUN yarn build FROM nginx:alpine + COPY docker/www/nginx.conf /etc/nginx/nginx.conf RUN rm -rf /usr/share/nginx/html/* COPY --from=builder /build /usr/share/nginx/html From 1dcfd7e9c0ca28d22e9b0d1d51e1b179984737af Mon Sep 17 00:00:00 2001 From: Fedor Katurov Date: Thu, 30 Nov 2023 21:30:48 +0700 Subject: [PATCH 3/4] change backend and osrm urls --- .drone.yml | 4 ++-- src/components/panels/UserPanel.tsx | 4 ++-- src/config/frontend.ts | 2 -- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.drone.yml b/.drone.yml index 23b9bea..2615559 100644 --- a/.drone.yml +++ b/.drone.yml @@ -14,8 +14,8 @@ steps: - master environment: REACT_APP_PUBLIC_PATH: https://map.vault48.org/ - REACT_APP_API_ADDR: https://backend.map.vault48.org - REACT_APP_OSRM_URL: https://vault48.org:5001/route/v1 + REACT_APP_API_ADDR: https://backend-map.vault48.org + REACT_APP_OSRM_URL: https://osrm.vault48.org/route/v1 REACT_APP_OSRM_PROFILE: bike settings: dockerfile: docker/www/Dockerfile diff --git a/src/components/panels/UserPanel.tsx b/src/components/panels/UserPanel.tsx index 047643c..ef198b6 100644 --- a/src/components/panels/UserPanel.tsx +++ b/src/components/panels/UserPanel.tsx @@ -63,7 +63,7 @@ export class UserPanelUnconnected extends PureComponent { }; componentDidMount() { - window.addEventListener('message', e => { + window.addEventListener('message', (e) => { const { data } = e; if ( @@ -123,7 +123,7 @@ export class UserPanelUnconnected extends PureComponent { openGpxDialog = () => { this.props.editorChangeMode(MODES.GPX); - } + }; render() { const { diff --git a/src/config/frontend.ts b/src/config/frontend.ts index bc96649..af1bdb2 100644 --- a/src/config/frontend.ts +++ b/src/config/frontend.ts @@ -10,8 +10,6 @@ const OSRM_TEST_URL = ([south_west, north_east]: LatLngLiteral[]) => north_east ).join(',')}`; -console.log('its', process.env.REACT_APP_API_ADDR); - export const CLIENT = { OSRM_URL, API_ADDR, From 322337edea01200982b0362216b89d454f954a74 Mon Sep 17 00:00:00 2001 From: Fedor Katurov Date: Fri, 29 Dec 2023 12:34:09 +0700 Subject: [PATCH 4/4] add analytics --- public/index.html | 3 +++ 1 file changed, 3 insertions(+) diff --git a/public/index.html b/public/index.html index 0917b3d..b109d7a 100644 --- a/public/index.html +++ b/public/index.html @@ -6,6 +6,9 @@ Редактор маршрутов + + +