vcl static site generator
1.0.0
I don't want to run a web server because my sites are such low traffic that they'd always be absent from cache, and need fetching every time. But code is free, so I made a static site generator to convert a directory of files to a VCL table, and index it by URL.
This isn't a generator so much as an uploader. You need to provide your own directory of files.
<base href="..."/>
; export SID= # service ID
; export KEY= # API key
; export VER= # unlocked (not yet activated) version
; curl -X POST -s https://api.fastly.com/service/$SID/version/$VER/snippet
-H "Fastly-Key:$KEY" -H 'Content-Type: application/x-www-form-urlencoded'
--data $'name=data&type=init&dynamic=1&content=table body {}n'
{"name":"synth","type":"init","dynamic":1,"content":null,"service_id":"...",
"version":"...","deleted_at":null,"id":"...","updated_at":"...","priority":100,
"created_at":"..."}
Remember the snippet ID there - you'll need it for updates.
; KEY=... SID=... SNIPPET=... ./update.sh /path/to/htdocs
Q. Why not use edge dictionaries?
A. The API doesn't provide a “replace everything in one go” operation.
Also they render to VCL anyway; here I can generate the same VCL in the first place.