Skip to content

Commit 9c7f378

Browse files
committed
Add dependency on imgproxy service and update version
1 parent 4823732 commit 9c7f378

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

docker-compose.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ services:
1212
interval: 2s
1313
timeout: 10s
1414
retries: 5
15+
depends_on:
16+
imgproxy:
17+
condition: service_healthy
1518
imgproxy:
1619
image: darthsim/imgproxy
1720
environment:

index.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
1-
const allowedDomains = process.env.ALLOWED_REMOTE_DOMAINS.split(",") || ["*"];
2-
const imgproxyUrl = process.env.IMGPROXY_URL || "http://imgproxy:8080";
3-
1+
const allowedDomains = process?.env?.ALLOWED_REMOTE_DOMAINS.split(",") || ["*"];
2+
const imgproxyUrl = process?.env?.IMGPROXY_URL || "http://imgproxy:8080";
3+
const version = "0.0.2"
44
Bun.serve({
55
port: 3000,
66
async fetch(req) {
77
const url = new URL(req.url);
8+
if (url.pathname === "/") {
9+
return new Response(`<h3>Next Image Transformation v${version}</h3>More info <a href="https://github.com/coollabsio/next-image-transformation">https://github.com/coollabsio/next-image-transformation</a>.`, {
10+
headers: {
11+
"Content-Type": "text/html",
12+
},
13+
});
14+
}
15+
16+
817
if (url.pathname === "/health") {
918
return new Response("OK");
1019
};

0 commit comments

Comments
 (0)