Fully migrated project, tested dev and compile binaries

This commit is contained in:
Luke Hagar
2024-03-05 15:57:54 -06:00
parent ed41285b4b
commit cacba3a343
224 changed files with 180519 additions and 29445 deletions

38
out/renderer/env.js Normal file
View File

@@ -0,0 +1,38 @@
/* global "" */
const expected = new Set([
'SOCKET_PATH',
'HOST',
'PORT',
'ORIGIN',
'XFF_DEPTH',
'ADDRESS_HEADER',
'PROTOCOL_HEADER',
'HOST_HEADER',
'PORT_HEADER',
'BODY_SIZE_LIMIT'
]);
if ("") {
for (const name in process.env) {
if (name.startsWith("")) {
const unprefixed = name.slice("".length);
if (!expected.has(unprefixed)) {
throw new Error(
`You should change envPrefix (${""}) to avoid conflicts with existing environment variables — unexpectedly saw ${name}`
);
}
}
}
}
/**
* @param {string} name
* @param {any} fallback
*/
function env(name, fallback) {
const prefixed = "" + name;
return prefixed in process.env ? process.env[prefixed] : fallback;
}
export { env };