Skip to content

Commit

Permalink
feat: Point MyMap and AddressAutocomplete at proxy endpoint (#1349)
Browse files Browse the repository at this point in the history
  • Loading branch information
DafyddLlyr authored Dec 22, 2022
1 parent 827aa00 commit 63b6160
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 22 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,6 @@ jobs:
REACT_APP_API_URL: https://api.${{ env.FULL_DOMAIN }}
REACT_APP_FEEDBACK_FISH_ID: 65f02de00b90d1
REACT_APP_HASURA_URL: https://hasura.${{ env.FULL_DOMAIN }}/v1/graphql
REACT_APP_ORDNANCE_SURVEY_KEY: ${{ secrets.ORDNANCE_SURVEY_KEY }}
REACT_APP_SHAREDB_URL: wss://sharedb.${{ env.FULL_DOMAIN }}
# needed because there's no API to change google's allowed OAuth URLs
REACT_APP_GOOGLE_OAUTH_OVERRIDE: https://api.editor.planx.dev
Expand Down Expand Up @@ -244,7 +243,6 @@ jobs:
REACT_APP_API_URL: https://api.${{ env.FULL_DOMAIN }}
REACT_APP_FEEDBACK_FISH_ID: 65f02de00b90d1
REACT_APP_HASURA_URL: https://hasura.${{ env.FULL_DOMAIN }}/v1/graphql
REACT_APP_ORDNANCE_SURVEY_KEY: ${{ secrets.ORDNANCE_SURVEY_KEY }}
REACT_APP_SHAREDB_URL: wss://sharedb.${{ env.FULL_DOMAIN }}
REACT_APP_GOOGLE_OAUTH_OVERRIDE: https://api.editor.planx.dev

Expand Down
1 change: 0 additions & 1 deletion .github/workflows/push-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ jobs:
- run: pnpm build
working-directory: editor.planx.uk
env:
REACT_APP_ORDNANCE_SURVEY_KEY: ${{ secrets.ORDNANCE_SURVEY_KEY }}
REACT_APP_API_URL: https://api.editor.planx.dev
REACT_APP_FEEDBACK_FISH_ID: 65f02de00b90d1
REACT_APP_HASURA_URL: https://hasura.editor.planx.dev/v1/graphql
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/push-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ jobs:
- run: pnpm build
working-directory: editor.planx.uk
env:
REACT_APP_ORDNANCE_SURVEY_KEY: ${{ secrets.ORDNANCE_SURVEY_KEY }}
REACT_APP_API_URL: https://api.editor.planx.uk
REACT_APP_FEEDBACK_FISH_ID: 65f02de00b90d1
REACT_APP_HASURA_URL: https://hasura.editor.planx.uk/v1/graphql
Expand Down
2 changes: 1 addition & 1 deletion api.planx.uk/proxy/ordnanceSurvey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const OS_DOMAIN = "https://api.os.uk";

const MAP_ALLOWLIST: RegExp[] = [
// Local development
/^http:\/\/(127\.0\.0\.1|localhost):(5173|7007)\/$/i,
/^http:\/\/(127\.0\.0\.1|localhost):(3000|5173|6006|7007)\/$/i,
// Documentation
/^https:\/\/.*\.netlify\.app\/$/i,
// PlanX
Expand Down
6 changes: 1 addition & 5 deletions editor.planx.uk/.env.example
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# Used in all environments

REACT_APP_ORDNANCE_SURVEY_KEY=👻

# Used in local development and testing, overwritten in .env.production

REACT_APP_AIRBRAKE_PROJECT_ID=👻
Expand All @@ -11,4 +7,4 @@ REACT_APP_FEEDBACK_FISH_ID=65f02de00b90d1

REACT_APP_API_URL=http://localhost:7002
REACT_APP_HASURA_URL=http://localhost:7000/v1/graphql
REACT_APP_SHAREDB_URL=ws://localhost:7003
REACT_APP_SHAREDB_URL=ws://localhost:7003
2 changes: 1 addition & 1 deletion editor.planx.uk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"@mui/material": "^5.10.5",
"@mui/styles": "^5.10.3",
"@mui/utils": "^5.10.3",
"@opensystemslab/map": "^0.6.1",
"@opensystemslab/map": "^0.6.3",
"@tiptap/core": "2.0.0-beta.204",
"@tiptap/extension-bold": "2.0.0-beta.204",
"@tiptap/extension-bubble-menu": "2.0.0-beta.204",
Expand Down
13 changes: 7 additions & 6 deletions editor.planx.uk/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const MapOnly = () => {
drawMode
zoom={19}
maxZoom={20}
osVectorTilesApiKey={process.env.REACT_APP_ORDNANCE_SURVEY_KEY}
osProxyEndpoint={`${process.env.REACT_APP_API_URL}/proxy/ordnance-survey`}
/>
</>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ export default function Component(props: Props) {
markerLatitude={Number(passport?.data?._address?.latitude)}
markerLongitude={Number(passport?.data?._address?.longitude)}
resetControlImage="trash"
osVectorTilesApiKey={process.env.REACT_APP_ORDNANCE_SURVEY_KEY}
osProxyEndpoint={`${process.env.REACT_APP_API_URL}/proxy/ordnance-survey`}
/>
{!props.hideFileUpload && (
<MapFooter>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ function GetAddress(props: {
data-testid="address-autocomplete-web-component"
postcode={sanitizedPostcode}
initialAddress={selectedOption?.title || ""}
osPlacesApiKey={process.env.REACT_APP_ORDNANCE_SURVEY_KEY}
osProxyEndpoint={`${process.env.REACT_APP_API_URL}/proxy/ordnance-survey`}
arrowStyle="light"
labelStyle="static"
/>
Expand Down Expand Up @@ -420,7 +420,7 @@ export function PropertyInformation(props: any) {
zoom={19.5}
latitude={lat}
longitude={lng}
osVectorTilesApiKey={process.env.REACT_APP_ORDNANCE_SURVEY_KEY}
osProxyEndpoint={`${process.env.REACT_APP_API_URL}/proxy/ordnance-survey`}
hideResetControl
showMarker
markerLatitude={lat}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ function DrawBoundary(props: ComponentProps) {
geojsonColor="#ff0000"
geojsonFill
geojsonBuffer="20"
osVectorTilesApiKey={process.env.REACT_APP_ORDNANCE_SURVEY_KEY}
osProxyEndpoint={`${process.env.REACT_APP_API_URL}/proxy/ordnance-survey`}
hideResetControl
staticMode
style={{ width: "100%", height: "30vh" }}
Expand Down

0 comments on commit 63b6160

Please sign in to comment.