read values from env

This commit is contained in:
2026-08-04 23:05:11 -07:00
parent 54af35299d
commit aa2bf08255
2 changed files with 10 additions and 4 deletions

View File

@@ -2,7 +2,7 @@ const fplay = require("./lib/fplay.js");
var port = 3030; var port = 3030;
var timeout = 30000; var timeout = 30000;
var password = "cnc"; var password = process.env.FOURPLAY_PASSWORD || "cnc";
fplay.event.on("server_ready", function(){ fplay.event.on("server_ready", function(){

View File

@@ -1,11 +1,13 @@
const http = require("http"); const http = require("http");
const { WebSocketServer } = require("ws"); const { WebSocketServer } = require("ws");
const {FOURPLAY_PORT = 3000, FOURPLAY_COMMAND_TIMEOUT = 5000, FOURPLAY_PASSWORD = "cnc"} = process.env;
var fplay = {}; var fplay = {};
fplay.PORT = 3030; fplay.PORT = FOURPLAY_PORT;
fplay.COMMAND_TIMEOUT = 5000; fplay.COMMAND_TIMEOUT = FOURPLAY_COMMAND_TIMEOUT;
fplay.PASSWORD = "cnc"; fplay.PASSWORD = FOURPLAY_PASSWORD;
const { EventEmitter } = require("events"); const { EventEmitter } = require("events");
fplay.event = new EventEmitter(); fplay.event = new EventEmitter();
@@ -558,4 +560,8 @@ fplay.init = function(port = 3030, password = "cnc", command_timeout = 5000){
}); });
} }
process.on('SIGINT', function() {
process.exit();
});
module.exports = fplay; module.exports = fplay;