fix: move health endpoint before auth middleware, add curl to alpine
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
FROM node:20-alpine
|
FROM node:20-alpine
|
||||||
|
RUN apk add --no-cache curl
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY package.json ./
|
COPY package.json ./
|
||||||
RUN npm install --production
|
RUN npm install --production
|
||||||
|
|||||||
@@ -65,6 +65,10 @@ const smtp = new SMTPServer({
|
|||||||
|
|
||||||
const app = express();
|
const app = express();
|
||||||
|
|
||||||
|
app.get("/health", (_req, res) => {
|
||||||
|
res.json({ status: "ok", stored: store.size });
|
||||||
|
});
|
||||||
|
|
||||||
app.use((req, res, next) => {
|
app.use((req, res, next) => {
|
||||||
if (API_KEY && req.headers["x-api-key"] !== API_KEY) {
|
if (API_KEY && req.headers["x-api-key"] !== API_KEY) {
|
||||||
return res.status(401).json({ error: "unauthorized" });
|
return res.status(401).json({ error: "unauthorized" });
|
||||||
@@ -72,10 +76,6 @@ app.use((req, res, next) => {
|
|||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get("/health", (_req, res) => {
|
|
||||||
res.json({ status: "ok", stored: store.size });
|
|
||||||
});
|
|
||||||
|
|
||||||
app.get("/mail/:address", (req, res) => {
|
app.get("/mail/:address", (req, res) => {
|
||||||
const addr = req.params.address.toLowerCase();
|
const addr = req.params.address.toLowerCase();
|
||||||
const mails = store.get(addr) || [];
|
const mails = store.get(addr) || [];
|
||||||
|
|||||||
Reference in New Issue
Block a user