make port changeable through env
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
API_KEY=apiKey
|
||||
PORT=
|
||||
|
||||
TIDAL_HOST=http://localhost
|
||||
TIDAL_PORT=47836
|
||||
|
||||
@@ -4,6 +4,7 @@ dotenv.config();
|
||||
|
||||
export const Config = {
|
||||
api_key: process.env.API_KEY,
|
||||
port: process.env.PORT || "8080",
|
||||
|
||||
tidal: {
|
||||
host: process.env.TIDAL_HOST || "",
|
||||
|
||||
@@ -141,10 +141,13 @@ server.register(
|
||||
{ prefix: "/api" },
|
||||
);
|
||||
|
||||
server.listen({ port: 8080, host: "0.0.0.0" }, (err, address) => {
|
||||
server.listen(
|
||||
{ port: parseInt(Config.port, 10), host: "0.0.0.0" },
|
||||
(err, address) => {
|
||||
if (err) {
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
}
|
||||
console.log(`Server listening at ${address}`);
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user