Update ENV handling

This commit is contained in:
Matt McWilliams 2025-01-19 11:19:06 -05:00
parent 748551a353
commit 2588356ab8
6 changed files with 45 additions and 36 deletions

1
dist/fd/index.js vendored
View File

@ -45,6 +45,7 @@ class FD {
this.env = { this.env = {
DISPLAY: display DISPLAY: display
}; };
this.log.info(`Using DISPLAY=${display} for fd`);
} }
this.shell = new shell_1.Shell([ this.shell = new shell_1.Shell([
this.bin, this.bin,

File diff suppressed because one or more lines are too long

39
dist/index.js vendored
View File

@ -82,6 +82,13 @@ async function createTemplate(filePath) {
async function settings() { async function settings() {
let sequencesExists = false; let sequencesExists = false;
let videosExists = false; let videosExists = false;
if ((0, env_1.envString)('FFMPEG', null) === null) {
log.error('Please include an FFMPEG value containing the path to your ffmpeg binary in .env');
process.exit(1);
}
else {
log.info(`FFMPEG=${process.env['FFMPEG']}`);
}
if ((0, env_1.envString)('FD', null) === null) { if ((0, env_1.envString)('FD', null) === null) {
log.error('Please include an FD value containing the path to your fd binary in .env'); log.error('Please include an FD value containing the path to your fd binary in .env');
process.exit(1); process.exit(1);
@ -89,12 +96,22 @@ async function settings() {
else { else {
log.info(`FD=${process.env['FD']}`); log.info(`FD=${process.env['FD']}`);
} }
if ((0, env_1.envString)('FFMPEG', null) === null) { if ((0, env_1.envString)('FD_DISPLAY', null) !== null) {
log.error('Please include an FFMPEG value containing the path to your ffmpeg binary in .env'); log.info(`FD_DISPLAY=${(0, env_1.envString)('FD_DISPLAY', null)}`);
process.exit(1); }
if ((0, env_1.envString)('FD_HOST', null) === null) {
log.error('Please include a FD_HOST value with the host that the fd socket server is hosted on in .env');
process.exit(4);
} }
else { else {
log.info(`FFMPEG=${process.env['FFMPEG']}`); log.info(`FD_HOST=${process.env['FD_HOST']}`);
}
if ((0, env_1.envInt)('FD_PORT', null) === null) {
log.error('Please include a FD_PORT value with the port that the fd socket server is hosted on in .env');
process.exit(5);
}
else {
log.info(`FD_PORT=${process.env['FD_PORT']}`);
} }
if ((0, env_1.envInt)('WIDTH', null) === null) { if ((0, env_1.envInt)('WIDTH', null) === null) {
log.error('Please include a WIDTH value containing the width of the screen you are using in .env'); log.error('Please include a WIDTH value containing the width of the screen you are using in .env');
@ -112,20 +129,6 @@ async function settings() {
height = (0, env_1.envInt)('HEIGHT', 0); height = (0, env_1.envInt)('HEIGHT', 0);
log.info(`HEIGHT=${height}`); log.info(`HEIGHT=${height}`);
} }
if ((0, env_1.envString)('FD_HOST', null) === null) {
log.error('Please include a FD_HOST value with the host that the fd socket server is hosted on in .env');
process.exit(4);
}
else {
log.info(`FD_HOST=${process.env['FD_HOST']}`);
}
if ((0, env_1.envInt)('FD_PORT', null) === null) {
log.error('Please include a FD_PORT value with the port that the fd socket server is hosted on in .env');
process.exit(5);
}
else {
log.info(`FD_PORT=${process.env['FD_PORT']}`);
}
if ((0, env_1.envInt)('PORT', null) === null) { if ((0, env_1.envInt)('PORT', null) === null) {
log.error('Please include a PORT value with the port that the HTTP web process is hosted on in .env'); log.error('Please include a PORT value with the port that the HTTP web process is hosted on in .env');
process.exit(6); process.exit(6);

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -79,6 +79,7 @@ export class FD {
this.env = { this.env = {
DISPLAY : display DISPLAY : display
} }
this.log.info(`Using DISPLAY=${display} for fd`);
} }
this.shell = new Shell([ this.shell = new Shell([
this.bin, this.bin,

View File

@ -78,17 +78,32 @@ async function createTemplate (filePath : string) : Promise<HandlebarsTemplateDe
async function settings () { async function settings () {
let sequencesExists : boolean = false; let sequencesExists : boolean = false;
let videosExists : boolean = false; let videosExists : boolean = false;
if (envString('FFMPEG', null) === null) {
log.error('Please include an FFMPEG value containing the path to your ffmpeg binary in .env');
process.exit(1);
} else {
log.info(`FFMPEG=${process.env['FFMPEG']}`);
}
if (envString('FD', null) === null) { if (envString('FD', null) === null) {
log.error('Please include an FD value containing the path to your fd binary in .env'); log.error('Please include an FD value containing the path to your fd binary in .env');
process.exit(1); process.exit(1);
} else { } else {
log.info(`FD=${process.env['FD']}`); log.info(`FD=${process.env['FD']}`);
} }
if (envString('FFMPEG', null) === null) { if (envString('FD_DISPLAY', null) !== null) {
log.error('Please include an FFMPEG value containing the path to your ffmpeg binary in .env'); log.info(`FD_DISPLAY=${envString('FD_DISPLAY', null)}`);
process.exit(1); }
if (envString('FD_HOST', null) === null) {
log.error('Please include a FD_HOST value with the host that the fd socket server is hosted on in .env');
process.exit(4);
} else { } else {
log.info(`FFMPEG=${process.env['FFMPEG']}`); log.info(`FD_HOST=${process.env['FD_HOST']}`);
}
if (envInt('FD_PORT', null) === null) {
log.error('Please include a FD_PORT value with the port that the fd socket server is hosted on in .env')
process.exit(5);
} else {
log.info(`FD_PORT=${process.env['FD_PORT']}`);
} }
if (envInt('WIDTH', null) === null) { if (envInt('WIDTH', null) === null) {
log.error('Please include a WIDTH value containing the width of the screen you are using in .env'); log.error('Please include a WIDTH value containing the width of the screen you are using in .env');
@ -104,18 +119,6 @@ async function settings () {
height = envInt('HEIGHT', 0); height = envInt('HEIGHT', 0);
log.info(`HEIGHT=${height}`); log.info(`HEIGHT=${height}`);
} }
if (envString('FD_HOST', null) === null) {
log.error('Please include a FD_HOST value with the host that the fd socket server is hosted on in .env');
process.exit(4);
} else {
log.info(`FD_HOST=${process.env['FD_HOST']}`);
}
if (envInt('FD_PORT', null) === null) {
log.error('Please include a FD_PORT value with the port that the fd socket server is hosted on in .env')
process.exit(5);
} else {
log.info(`FD_PORT=${process.env['FD_PORT']}`);
}
if (envInt('PORT', null) === null) { if (envInt('PORT', null) === null) {
log.error('Please include a PORT value with the port that the HTTP web process is hosted on in .env'); log.error('Please include a PORT value with the port that the HTTP web process is hosted on in .env');
process.exit(6); process.exit(6);
@ -167,6 +170,7 @@ async function settings () {
mock = false; mock = false;
} }
} }
} }
function onWssConnection (ws : WebSocketExtended, req : Request) { function onWssConnection (ws : WebSocketExtended, req : Request) {