aboutsummaryrefslogtreecommitdiff
path: root/src/index.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/index.ts')
-rw-r--r--src/index.ts35
1 files changed, 0 insertions, 35 deletions
diff --git a/src/index.ts b/src/index.ts
index 71da73c..76620e8 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -9,7 +9,6 @@ import expressWinston from "express-winston";
dotenv.config();
-import processTemplate, { Template } from "./templates";
import routes from "./routes";
import Metadata from "./metadata";
import loggerConfig from "./util/logger";
@@ -18,7 +17,6 @@ import { configOrError, handleShutdown } from "./util/config";
// Start-up configuration
const BIND_ADDRESS = process.env.BIND_ADDRESS ?? "localhost";
const PORT = Number(process.env.PORT ?? 3000);
-const TARGET_URL = process.env.TARGET_URL ?? "http://localhost:3000";
const logger = winston.createLogger(loggerConfig("ROOT"));
@@ -32,39 +30,6 @@ if (!path.isAbsolute(HOST_DIR)) {
process.exit(1);
}
-// prepare template files
-const bashTemplate = {
- inputFile: path.join(__dirname, "..", "public", "templates", "bash.template"),
- outputFile: path.join(HOST_DIR, "bash"),
- context: { TARGET_URL }
-} as Template;
-const indexTemplate = {
- inputFile: path.join(__dirname, "..", "public", "templates", "index.html.template"),
- outputFile: path.join(HOST_DIR, "index.html"),
- context: { TARGET_URL }
-} as Template;
-
-processTemplate(bashTemplate)
- .then(template => {
- logger.debug("Generated '%s' from template file", template.outputFile);
- })
- .then(() => processTemplate(indexTemplate))
- .then(template => {
- logger.debug("Generated '%s' from template file", template.outputFile);
- })
- .catch(err => {
- logger.error("Unable to process template file: %s", err);
-
- // if the output file exists, then we are fine with continuing without
- return fs.promises.access(bashTemplate.outputFile, fs.constants.R_OK);
- })
- .then(() => fs.promises.access(indexTemplate.outputFile, fs.constants.R_OK))
- .catch(err => {
- logger.error("Cannot proceed: %s", err);
-
- process.exit(1);
- });
-
new MongoClient(MONGO_URI, { useUnifiedTopology: true }).connect(
(err, mongo) => {
if (err !== null) {