Use env var PORT instead of --port flag

This commit is contained in:
sepia 2025-07-24 15:18:19 -05:00
parent 419904fb3c
commit 6bea470c38
2 changed files with 2 additions and 16 deletions

View file

@ -91,19 +91,7 @@ const app = new Elysia()
});
});
const port = (() => {
let p = 3000;
for (let i = 0; i < Bun.argv.length; i++) {
if (Bun.argv[i] === '--port') {
const parsedPort = Number(Bun.argv[i + 1]);
if (!isNaN(parsedPort) && parsedPort > 0) {
p = parsedPort;
break;
}
}
}
return p;
})();
const port = Number(process.env.PORT || 3000);
app.listen(port, () => {
console.log(`🦊 Elysia is running at ${app.server?.hostname}:${port}`);