Skip to content

Commit

Permalink
Add dependency on imgproxy service and update version
Browse files Browse the repository at this point in the history
  • Loading branch information
andrasbacsai committed Mar 6, 2024
1 parent 4823732 commit 9c7f378
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
3 changes: 3 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ services:
interval: 2s
timeout: 10s
retries: 5
depends_on:
imgproxy:
condition: service_healthy
imgproxy:
image: darthsim/imgproxy
environment:
Expand Down
15 changes: 12 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
const allowedDomains = process.env.ALLOWED_REMOTE_DOMAINS.split(",") || ["*"];
const imgproxyUrl = process.env.IMGPROXY_URL || "http://imgproxy:8080";

const allowedDomains = process?.env?.ALLOWED_REMOTE_DOMAINS.split(",") || ["*"];
const imgproxyUrl = process?.env?.IMGPROXY_URL || "http://imgproxy:8080";
const version = "0.0.2"
Bun.serve({
port: 3000,
async fetch(req) {
const url = new URL(req.url);
if (url.pathname === "/") {
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>.`, {
headers: {
"Content-Type": "text/html",
},
});
}


if (url.pathname === "/health") {
return new Response("OK");
};
Expand Down

0 comments on commit 9c7f378

Please sign in to comment.