Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 0911472

Browse files
authoredOct 17, 2022
Merge pull request #3 from fastly/demo-thumb
Updates for demo
2 parents 36e73c8 + 5ca79ed commit 0911472

File tree

4 files changed

+30
-21
lines changed

4 files changed

+30
-21
lines changed
 

‎fastly.toml

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,27 @@ description = "Park your users in a virtual queue to reduce the demand on your o
66
language = "javascript"
77
manifest_version = 2
88
name = "Queuing / Waiting room (JS)"
9-
service_id = "2m8R5zIahiGBdKTfYv8k8L"
109

1110
[local_server]
1211

1312
[local_server.backends]
1413

1514
[local_server.backends.protected_content]
16-
url = "http://eventworld-static.s3-website.eu-west-2.amazonaws.com"
17-
override_host = "eventworld-static.s3-website.eu-west-2.amazonaws.com"
15+
override_host = "eventworld-static.s3-website.eu-west-2.amazonaws.com"
16+
url = "http://eventworld-static.s3-website.eu-west-2.amazonaws.com"
1817

1918
[local_server.backends.upstash]
20-
url = "https://eu1-close-treefrog-37046.upstash.io"
21-
override_host = "eu1-close-treefrog-37046.upstash.io"
19+
override_host = "eu1-close-treefrog-37046.upstash.io"
20+
url = "https://eu1-close-treefrog-37046.upstash.io"
2221

2322
[local_server.dictionaries]
2423

2524
[local_server.dictionaries.config]
26-
27-
format = "json"
2825
file = "devconfig.json"
26+
format = "json"
27+
28+
[scripts]
29+
build = "$(npm bin)/webpack && $(npm bin)/js-compute-runtime ./bin/index.js ./bin/main.wasm"
2930

3031
[setup]
3132

@@ -35,24 +36,21 @@ service_id = "2m8R5zIahiGBdKTfYv8k8L"
3536

3637
[setup.backends.upstash]
3738

38-
[setup.log_endpoints]
39-
40-
[setup.log_endpoints.queue_logs]
41-
4239
[setup.dictionaries]
4340

4441
[setup.dictionaries.config]
4542

4643
[setup.dictionaries.config.items]
4744

48-
[setup.dictionaries.config.items.upstash_url]
49-
description = "URL of Upstash service (e.g. https://eu1-close-treefrog-35041.upstash.io)"
50-
input_type = "url"
45+
[setup.dictionaries.config.items.jwt_secret]
46+
description = "Secret for JWT signing"
5147

5248
[setup.dictionaries.config.items.upstash_token]
53-
description = "Token for Upstash REST API"
54-
input_type = "password"
49+
description = "Token for Upstash REST API"
5550

56-
[setup.dictionaries.config.items.jwt_secret]
57-
description = "Secret for JWT signing"
58-
input_type = "password"
51+
[setup.dictionaries.config.items.upstash_url]
52+
description = "URL of Upstash service (e.g. https://eu1-close-treefrog-35041.upstash.io)"
53+
54+
[setup.log_endpoints]
55+
56+
[setup.log_endpoints.queue_logs]

‎src/index.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ import processView from "./views";
2424
import adminView from "./views/admin.html";
2525
import queueView from "./views/queue.html";
2626

27+
// For demo purposes
2728
import demoManifest from "./static/demo-manifest.md";
29+
const DEMO_THUMBNAIL = fastly.includeBytes('src/static/demo-thumb.png');
2830

2931
// The name of the backend serving the content that is being protected by the queue.
3032
const CONTENT_BACKEND = "protected_content";
@@ -49,14 +51,20 @@ async function handleRequest(event) {
4951
const { request, client } = event;
5052
const url = new URL(request.url);
5153

52-
// For demo purposes, we serve this manifest. Feel free to delete this.
54+
// Metadata foe developer.fastly.com.
55+
// Feel free to delete this.
5356
if (url.pathname == "/.well-known/fastly/demo-manifest") {
5457
return new Response(demoManifest, {
5558
status: 200,
5659
headers: {
5760
"Content-Type": "text/markdown",
5861
},
5962
});
63+
} else if (url.pathname == "/demo-thumb.png") {
64+
return new Response(DEMO_THUMBNAIL, {
65+
status: 200,
66+
headers: { 'content-type': 'image/png' }
67+
});
6068
}
6169

6270
// Allow requests to assets that are not protected by the queue.

‎src/static/demo-manifest.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@ description: |
66
Using a third-party Redis API provider as a lightweight store, issue
77
website visitors with a place in an orderly queue, and admit them to the
88
website in a way that regulates load on your origin infrastructure.
9-
# repo: https://github.com/fastly/compute-starter-kit-javascript-queue
9+
repo: https://github.com/fastly/compute-starter-kit-javascript-queue
10+
image:
11+
href: /demo-thumb.png
12+
alt: Holding page for a waiting room
1013
expectedRootStatus: 401
1114
views:
1215
endUser:

‎src/static/demo-thumb.png

1.04 MB
Loading

0 commit comments

Comments
 (0)
Please sign in to comment.