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