mirror of
https://github.com/Radiquum/AniX.git
synced 2025-09-06 06:23:53 +05:00
refactor/api-prox: unhardcode HOST and PORT to ENV VARS
This commit is contained in:
parent
3762e7e58f
commit
2f928579f9
2 changed files with 5 additions and 6 deletions
|
@ -13,6 +13,5 @@ COPY tsconfig.json ./
|
||||||
RUN mkdir -p /app/hooks
|
RUN mkdir -p /app/hooks
|
||||||
|
|
||||||
EXPOSE 7001
|
EXPOSE 7001
|
||||||
ENV PORT=7001
|
|
||||||
ENV HOSTNAME="0.0.0.0"
|
|
||||||
CMD ["npm", "run", "serve"]
|
CMD ["npm", "run", "serve"]
|
|
@ -20,8 +20,8 @@ app.use(
|
||||||
app.use(express.json());
|
app.use(express.json());
|
||||||
app.use(express.urlencoded({ extended: true }));
|
app.use(express.urlencoded({ extended: true }));
|
||||||
|
|
||||||
const host = "0.0.0.0";
|
const HOST = process.env.HOST || "0.0.0.0";
|
||||||
const port = 7001;
|
const PORT = process.env.PORT ? parseInt(process.env.PORT, 10) : 7001;
|
||||||
|
|
||||||
let hooks: string[] = [];
|
let hooks: string[] = [];
|
||||||
|
|
||||||
|
@ -356,7 +356,7 @@ app.post("/*path", async (req, res) => {
|
||||||
return;
|
return;
|
||||||
});
|
});
|
||||||
|
|
||||||
app.listen(port, host, function () {
|
app.listen(PORT, HOST, function () {
|
||||||
loadHooks();
|
loadHooks();
|
||||||
logger.info(`Server listen: http://${host}:${port}`);
|
logger.info(`Server listen: http://${HOST}:${PORT}`);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue