Эх сурвалжийг харах

configurable port and hostname

marek 1 сар өмнө
parent
commit
1cec961d00
2 өөрчлөгдсөн 5 нэмэгдсэн , 2 устгасан
  1. 3 0
      .env.example
  2. 2 2
      index.js

+ 3 - 0
.env.example

@@ -4,6 +4,9 @@
 
 BASE_URL="http://127.0.0.1:3000"
 
+HOSTNAME="127.0.0.1"
+PORT="3000"
+
 # ---
 
 # ratelimits

+ 2 - 2
index.js

@@ -10,6 +10,6 @@ new Elysia()
 
     return file;
   })
-  .listen({ hostname: "127.0.0.1", port: 3000 })
+  .listen({ hostname: process.env.HOSTNAME, port: process.env.PORT })
 
-console.log(`running on port 3000`)
+console.log(`running on ${process.env.HOSTNAME}:${process.env.PORT}`)