diff --git a/.env b/.env index 9041ace85..2656bd3e8 100644 --- a/.env +++ b/.env @@ -1,4 +1,13 @@ VITE_MAPTILER_API_KEY="MZEJTanw3WpxRvt7qDfo" + +# By default, use S3. Only includes public data. VITE_RESOURCE_BASE="https://atip.uk" -#VITE_RESOURCE_BASE="https://atip-test-1.ew.r.appspot.com/data" -VITE_ON_GCP=false + +# Use when deploying to GCP. Public and private data included. +#VITE_RESOURCE_BASE="https://SOME-PROJECT-ID.ew.r.appspot.com/data" + +# Set to blank to use locally hosted files. You must populate (or symlink) +# public/layers and public/private_layers in this repo. +#VITE_RESOURCE_BASE="" +# When running locally, change to "true" to see private layers from local files +VITE_MIMIC_GCP_LOCALLY="false" diff --git a/.gitignore b/.gitignore index 060a0ce74..93bf8ec3b 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,5 @@ src/style/main.css src/style/main.css.map .sass-cache/ public/assets +public/layers +public/private_layers diff --git a/backend/README.md b/backend/README.md index 0565311b7..2418198f7 100644 --- a/backend/README.md +++ b/backend/README.md @@ -28,7 +28,7 @@ Note the URLs won't work; you have to manually replace `$PROJECT`. Names and regions should match above. 1. `gcloud storage --project=$PROJECT buckets create gs://$PROJECT --location=EUROPE-WEST2 --uniform-bucket-level-access` -2. Generate fake scheme data and upload it: `npm run generate-random-schemes && gsutil cp random_schemes.geojson gs://$PROJECT/` +2. Generate fake scheme data and upload it: `npm run generate-random-schemes && gsutil cp random_schemes.geojson gs://$PROJECT/private_layers/v1/` 3. Sync current public layers to GCS. This only works if you have S3 access (aka Dustin). Skip these otherwise, or download another way. This might take a few minutes, depending on your connection: `aws s3 sync s3://atip.uk/layers layers; gsutil -m cp -r ./layers gs://$PROJECT/` 4. Also copy private files (currently [only from Ordnance Survey](https://github.com/acteng/atip-data-prep/tree/main/ordnance_survey_layers)) into `gs://$PROJECT/private_layers/v1/`. These have to be generated by a developer; they can't be mirrored from S3, because our S3 bucket is only appropriate for public data. 5. Go to (or enable the OS Maps API in a new project) and copy the API key. Create a file `api_keys.json` containing `{"ordnance_survey": "that copied api key"}`, and upload it to the GCS bucket at `gs://$PROJECT/private_layers/api_keys.json`. diff --git a/docs/developer_guide.md b/docs/developer_guide.md index 63c84a6de..edb37589c 100644 --- a/docs/developer_guide.md +++ b/docs/developer_guide.md @@ -52,7 +52,8 @@ To run locally you'll need: - If you're modifying the Rust code, a handy command is `npm run wasm && npm run dev` - `npm run generate-schema-ts` to rebuild TS definitions from changes to `src/schemas/*.json` - `npm run setup-govuk` to rerun Sass and generate GOV.UK styles -- `npm run dev` to run Atip locally (N.B. you need to run all the above commands before running this command) +- `npm run dev` to run ATIP locally (N.B. you need to run all the above commands before running this command) + - To mimic GCP deployment and see private layers locally, follow instructions in `.env` and run `VITE_RESOURCE_BASE="" VITE_MIMIC_GCP_LOCALLY="true" npm run dev` - `npm run fmt` to auto-format code - `npm run check` to see TypeScript errors diff --git a/src/lib/browse/LoadRemoteSchemeData.svelte b/src/lib/browse/LoadRemoteSchemeData.svelte index b1a544544..341f9f121 100644 --- a/src/lib/browse/LoadRemoteSchemeData.svelte +++ b/src/lib/browse/LoadRemoteSchemeData.svelte @@ -1,4 +1,5 @@