Skip to content

Commit

Permalink
Use GAE config to plumb GCS bucket, and use ===
Browse files Browse the repository at this point in the history
  • Loading branch information
dabreegster committed Sep 13, 2023
1 parent 085b92e commit c999176
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion backend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Names and regions should match above.

### Deploy

1. Update `bucket` in `backend/server.js`
1. Update `GCS_BUCKET` in `backend/app.yaml`
2. Create the files to deploy: `VITE_ON_GCP="true" VITE_RESOURCE_BASE="https://atip-test-2.ew.r.appspot.com/data" npm run build && cd backend && rm -rf dist && cp -R ../dist .`
- Note we could make Cloud Build do this, but we'd have to get `wasm-pack` and other things set up there first
- GH Actions will eventually trigger CI deployments for our test environment, and we've already done the work of configuring that build environment
Expand Down
2 changes: 2 additions & 0 deletions backend/app.yaml
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
runtime: nodejs18
env_variables:
GCS_BUCKET: "atip-test-2"
4 changes: 3 additions & 1 deletion backend/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ import express from "express";
// This automatically finds gcloud credentials when running locally or the
// service account on GAE
let storage = new Storage();
let bucket = "atip-test-2";
// TODO Upfront check the bucket is accessible and has some expected files, so
// we could failfail for a bad deployment
let bucket = process.env.GCS_BUCKET;

let app = express();

Expand Down
2 changes: 1 addition & 1 deletion src/pages/BrowseSchemes.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
<h1>Browse schemes</h1>
<ZoomOutMap boundaryGeojson={$gjScheme} />
</div>
{#if import.meta.env.VITE_ON_GCP == "true"}
{#if import.meta.env.VITE_ON_GCP === "true"}
<LoadRemoteSchemeData {loadFile} />
{/if}
<FileInput label="Load schemes from GeoJSON" id="load-geojson" {loadFile} />
Expand Down

0 comments on commit c999176

Please sign in to comment.