Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
21b875e86c | ||
|
|
0de6972c2d |
No files matched your search
@@ -70,4 +70,3 @@ vendor/
|
||||
# Local dev configs
|
||||
config.yml
|
||||
config.yaml
|
||||
config.dev.yml
|
||||
@@ -79,12 +79,15 @@ docker-versioned:
|
||||
docker-test:
|
||||
@script/test
|
||||
|
||||
# Run local dev server in Docker
|
||||
# Run local dev server in Docker, with debug on and a new random signing
|
||||
# key each run. Log in to the page with the key it prints.
|
||||
devserver: docker-versioned devserver-stop
|
||||
@key="$$(head -c 32 /dev/urandom | base64)" && \
|
||||
docker run -d --name pixad-dev -p 8080:8080 \
|
||||
-v $(CURDIR)/config.dev.yml:/etc/pixa/config.yml:ro \
|
||||
pixa:latest
|
||||
@echo "pixad running at http://localhost:8080"
|
||||
-e PIXA_SIGNING_KEY="$$key" -e PIXA_DEBUG=true \
|
||||
pixa:latest >/dev/null && \
|
||||
echo "pixad running at http://localhost:8080" && \
|
||||
echo "signing key: $$key"
|
||||
|
||||
# Stop dev server
|
||||
devserver-stop:
|
||||
|
||||
@@ -84,12 +84,14 @@ image_path=/photos/cat.jpg # an image on it
|
||||
exp=$(($(date +%s) + 3600)) # the URL expires in one hour
|
||||
sig=$(printf '%s' "$image_host:$image_path::400:300:webp:$exp:85:cover" |
|
||||
openssl dgst -sha256 -hmac "$key" -binary | base64 | tr '+/' '-_')
|
||||
curl -o cat.webp \
|
||||
curl --fail-with-body -o cat.webp \
|
||||
"http://localhost:8080/v1/image/$image_host$image_path/400x300.webp?sig=$sig&exp=$exp"
|
||||
```
|
||||
|
||||
`cat.webp` is then the image at 400x300. The image path must not hold a `%`, a
|
||||
`:` or a query. Signed URLs explains how to sign those.
|
||||
`cat.webp` is then the image at 400x300. If pixa refuses the request, curl
|
||||
reports an error and `cat.webp` holds pixa's error message instead. The image
|
||||
path must not hold a `%`, a `:` or a query. Signed URLs explains how to sign
|
||||
those.
|
||||
|
||||
## Deployment
|
||||
|
||||
|
||||
Reference in new issue
Block a user