From 07bc0948904868070ba8e45fba8c85dcde9dbdf9 Mon Sep 17 00:00:00 2001 From: Eric Eastwood Date: Thu, 14 Jul 2022 11:26:53 -0500 Subject: [PATCH] Enable tracing by config so we can enable from argv, env variable, or config file (#41) --- server/server.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/server/server.js b/server/server.js index df75c0f..9762fc5 100644 --- a/server/server.js +++ b/server/server.js @@ -2,7 +2,13 @@ console.log('server process.env.NODE_ENV', process.env.NODE_ENV); -if (process.argv.includes('--tracing')) { +const assert = require('assert'); +const config = require('./lib/config'); +const basePort = config.get('basePort'); +assert(basePort); +const tracing = config.get('tracing'); + +if (tracing) { console.log('Tracing is active 🕵️'); const { startTracing } = require('./tracing/tracing.js'); startTracing(); @@ -11,8 +17,6 @@ if (process.argv.includes('--tracing')) { const express = require('express'); const installRoutes = require('./routes/install-routes'); -const config = require('./lib/config'); -const basePort = config.get('basePort'); const app = express(); installRoutes(app);