Skip to content

Commit ce1dc50

Browse files
committed
Use correct env variable
1 parent 5c7d00f commit ce1dc50

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

app.yaml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
service: fileset2
22
runtime: nodejs10
33
instance_class: F4
4-
entrypoint: node ./dist/src/index.js serve
5-
handlers:
6-
- url: /.*
7-
secure: always
8-
script: auto
4+
entrypoint: node ./dist/src/index.js serve

src/server.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,12 @@ export function createApp(siteId: string, branchOrRef: string) {
7777
const requestSiteId = envFromHostname.siteId || siteId;
7878
const requestBranchOrRef = envFromHostname.branchOrRef || branchOrRef;
7979

80+
if (req.params.debug) {
81+
console.log(
82+
`Site: ${requestSiteId}, Ref: ${requestBranchOrRef}, Bucket: ${process.env.GOOGLE_CLOUD_PROJECT}`
83+
);
84+
}
85+
8086
let blobPath = decodeURIComponent(req.path);
8187
if (blobPath.endsWith('/')) {
8288
blobPath += 'index.html';
@@ -95,7 +101,7 @@ export function createApp(siteId: string, branchOrRef: string) {
95101

96102
const manifestPaths = manifest.paths;
97103
const blobKey = manifestPaths[blobPath];
98-
const updatedUrl = `/${process.env.GCLOUD_PROJECT}.appspot.com/fileset/sites/${requestSiteId}/blobs/${blobKey}`;
104+
const updatedUrl = `/${process.env.GOOGLE_CLOUD_PROJECT}.appspot.com/fileset/sites/${requestSiteId}/blobs/${blobKey}`;
99105

100106
// TODO: Add custom 404 support based on site config.
101107
if (!blobKey) {
@@ -135,7 +141,7 @@ export function createApp(siteId: string, branchOrRef: string) {
135141
proxyRes.headers['cache-control'] = 'public, max-age=0036';
136142
proxyRes.headers['x-fileset-blob'] = blobKey;
137143
proxyRes.headers['x-fileset-ref'] = manifest.ref;
138-
proxyRes.headers['x-fileset-site'] = siteId;
144+
proxyRes.headers['x-fileset-site'] = requestSiteId;
139145
if (manifest.ttl) {
140146
proxyRes.headers['x-fileset-ttl'] = manifest.ttl;
141147
}

0 commit comments

Comments
 (0)