From a03d72407b8290b06d3ab0f12a4006c7ba5d498a Mon Sep 17 00:00:00 2001 From: Daniel Nolan Date: Sat, 4 Sep 2021 19:47:38 -0400 Subject: [PATCH] Configurable Server Port --- ci/config.js | 5 ++++- ci/startServer.js | 10 +++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/ci/config.js b/ci/config.js index 73a4663..4bf1822 100644 --- a/ci/config.js +++ b/ci/config.js @@ -11,13 +11,16 @@ const LANGUAGE_VERSIONS = { javascript: ['10.x', '10.x/babel'] } -const GRAPH_API = process.env.GRAPH_API || "http://localhost:3040/graphql"; +const BUILDER_PORT = process.env.BUILDER_PORT || 3040; + +const GRAPH_API = process.env.GRAPH_API || `http://localhost:${BUILDER_PORT}/graphql`; const RUN_URL = process.env.RUN_URL || "https://relayer-staging.chainshot.com/run/"; module.exports = { LANGUAGE_VERSIONS, EXECUTION_RESULTS, + BUILDER_PORT, GRAPH_API, RUN_URL, } diff --git a/ci/startServer.js b/ci/startServer.js index 9c22cc6..b9b9ba4 100644 --- a/ci/startServer.js +++ b/ci/startServer.js @@ -1,5 +1,6 @@ const childProcess = require("child_process"); const path = require("path"); +const { BUILDER_PORT } = require('./config'); const serverPath = path.join(__dirname, "..", "server"); function startServer() { @@ -7,12 +8,15 @@ function startServer() { const npmChild = childProcess.exec("npm i", { cwd: serverPath }); npmChild.on("exit", () => { const child = childProcess.fork('src/index', [], { - CONTENT_PATH: process.env.contentPath, - CONTENT_REPO_NAME: process.env.contentRepoName, cwd: serverPath, detached: true, silent: false, - env: { QUERY_ONLY: true } + env: { + CONTENT_PATH: process.env.CONTENT_PATH, + CONTENT_REPO_NAME: process.env.CONTENT_REPO_NAME, + QUERY_ONLY: true, + PORT: BUILDER_PORT + } }); child.on('message', (msg) => { if(msg === "started") {