-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: temporarily swap unsplash for a fastly-hosted randomiser
- Loading branch information
1 parent
891d8b6
commit 31d1e39
Showing
4 changed files
with
30 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
table potential_header_images { | ||
"0": "https://images.unsplash.com/photo-1603186744434-c3884b484291", | ||
"1": "https://images.unsplash.com/photo-1603186568789-159c2c62ade1", | ||
"2": "https://images.unsplash.com/photo-1603187430252-10c169c59608", | ||
"3": "https://images.unsplash.com/photo-1599511971355-6489fdbbfcc0", | ||
"4": "https://images.unsplash.com/photo-1599511971455-cc69549b09e8", | ||
"5": "https://images.unsplash.com/photo-1599512011173-da8b4bf85101" | ||
} | ||
|
||
sub vcl_recv { | ||
declare local var.key STRING; | ||
declare local var.table_length INTEGER; | ||
|
||
# Maximum key in potential_header_images. | ||
set var.table_length = 5; | ||
|
||
if (req.url.path ~ "^/__service/random-header-image$") { | ||
set var.key = std.itoa(randomint(0, var.table_length)); | ||
error 602 table.lookup(potential_header_images, var.key); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters