Build script

A build process that generates a package with single executable for each
component.
This commit is contained in:
Zaid Abdulla committed 2019-01-04 01:13:47 -08:00
1 parent 819e8a52a3
commit 0b59811924
23 files changed
+734 -688

No files matched your search

+18 -2
View File
@@ -19,6 +19,7 @@
"use strict";
const path = require("path");
const fs = require("fs");
const options = {
CONFIG_DIR: { type: "path", default: "config" },
@@ -52,6 +53,13 @@ const options = {
FS_LOG_FILE: { type: "path", default: "" },
FS_ACCESS_LOG_FILE: { type: "path", default: "" },
UI_WORKER_PROCESSES: { type: "int", default: 0 },
UI_PORT: { type: "int", default: 3000 },
UI_INTERFACE: { type: "string", default: "0.0.0.0" },
UI_SSL: { type: "bool", default: false },
UI_LOG_FILE: { type: "path", default: "" },
UI_ACCESS_LOG_FILE: { type: "path", default: "" },
UDP_CONNECTION_REQUEST_PORT: { type: "int", default: 0 },
DOWNLOAD_TIMEOUT: { type: "int", default: 3600 },
@@ -175,7 +183,9 @@ for (const [k, v] of Object.entries(process.env))
setConfig("CONFIG_DIR", options["CONFIG_DIR"]["default"]);
// Configuration file
const configFile = require(path.resolve(allConfig.CONFIG_DIR, "config"));
const configFile = JSON.parse(
fs.readFileSync(path.resolve(allConfig.CONFIG_DIR, "config.json"))
);
for (const [k, v] of Object.entries(configFile)) {
if (!setConfig(k, v))
// Pass as environment variable to be accessable by extensions
@@ -226,7 +236,13 @@ function getDefault(optionName) {
// Load authentication scripts
try {
exports.auth = require(path.resolve(allConfig.CONFIG_DIR, "auth"));
const authScript = fs.readFileSync(
path.resolve(allConfig.CONFIG_DIR, "auth.js")
);
exports.auth = (function(exports) {
eval(authScript.toString());
return exports;
})({});
} catch (error) {
// No auth.js exists
}