Skip to content

Commit

Permalink
Revert "[backend] Fix error with SSL on prisma"
Browse files Browse the repository at this point in the history
This reverts commit 5dff5f3.
  • Loading branch information
MananGandhi1810 committed Jan 12, 2025
1 parent 5dff5f3 commit 746fabb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
1 change: 0 additions & 1 deletion backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ RUN npx prisma generate

FROM node:lts-alpine AS production
WORKDIR /usr/src/app
RUN apk add --no-cache openssl3
COPY --from=builder /usr/src/app/node_modules ./node_modules
COPY --from=builder /usr/src/app/prisma ./prisma/
COPY . .
Expand Down
17 changes: 16 additions & 1 deletion backend/bin/www
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,22 @@ import { executeFromQueue } from "../execution-worker/execute.js";
var port = normalizePort(process.env.PORT || "3000");
app.set("port", port);

var server = http.createServer(app);
// Check if SSL certificates are present
if (
fs.existsSync(`./ssl/privkey.pem`) ||
fs.existsSync(`./ssl/fullchain.pem`)
) {
const options = {
key: fs.readFileSync(`./ssl/privkey.pem`),
cert: fs.readFileSync(`./ssl/fullchain.pem`),
};

console.log("SSL certificates found. Running in HTTPS mode.");
var server = https.createServer(options, app);
} else {
console.log("No SSL certificates found. Running in HTTP mode.");
var server = http.createServer(app);
}

try {
await onQueueMessage("execute", executeFromQueue);
Expand Down

0 comments on commit 746fabb

Please sign in to comment.