port config

This commit is contained in:
amy 2024-12-03 00:47:27 +03:30
parent 35476348e2
commit 9e0946d80e
Signed by: amy
SSH key fingerprint: SHA256:Y6VEv6ZOxI6zqjjOF4luhfaCoY+zDK0w62P+qhQYie4

View file

@ -26,6 +26,15 @@ if (!FILESIZE) {
process.exit(1);
}
const PORT = process.env.PORT
if (!PORT) {
console.error("no file size detected");
process.exit(1);
} else if (isNaN(Number(PORT)) && FILESIZE.trim() !== '') {
console.error("file size cannot be parsed.");
process.exit(1);
}
export const __filename = fileURLToPath(import.meta.url);
export const __dirname = path.dirname(__filename);
@ -103,7 +112,7 @@ fastify.get('/', async (request, reply) => {
})
fastify.listen({port: 3000}, (err, address) => {
fastify.listen({port: PORT}, (err, address) => {
if (err) {
fastify.log.error(err)
process.exit(1)