refactor/api-prox: unhardcode HOST and PORT to ENV VARS

This commit is contained in:
Kentai Radiquum 2025-07-08 16:26:28 +05:00
parent 3762e7e58f
commit 2f928579f9
Signed by: Radiquum
GPG key ID: 858E8EE696525EED
2 changed files with 5 additions and 6 deletions

View file

@ -13,6 +13,5 @@ COPY tsconfig.json ./
RUN mkdir -p /app/hooks
EXPOSE 7001
ENV PORT=7001
ENV HOSTNAME="0.0.0.0"
CMD ["npm", "run", "serve"]

View file

@ -20,8 +20,8 @@ app.use(
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
const host = "0.0.0.0";
const port = 7001;
const HOST = process.env.HOST || "0.0.0.0";
const PORT = process.env.PORT ? parseInt(process.env.PORT, 10) : 7001;
let hooks: string[] = [];
@ -356,7 +356,7 @@ app.post("/*path", async (req, res) => {
return;
});
app.listen(port, host, function () {
app.listen(PORT, HOST, function () {
loadHooks();
logger.info(`Server listen: http://${host}:${port}`);
logger.info(`Server listen: http://${HOST}:${PORT}`);
});