diff --git a/docker-compose.yml b/docker-compose.yml index d6f8223..849e3f9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -9,8 +9,6 @@ services: - /ffs/node_modules ports: - "3000:3000" - expose: - - "3000" command: "node server.js" task_runner_1: @@ -21,4 +19,4 @@ services: - .:/ffs/ - /ffs/node_modules network_mode: host - command: "node taskRunner.js" \ No newline at end of file + command: "node taskRunner.js lathe" \ No newline at end of file diff --git a/server.js b/server.js index dd3c676..3ffef8c 100644 --- a/server.js +++ b/server.js @@ -104,7 +104,7 @@ const createServer = () => { res.send(credentials); } else { console.log( - '\x1b[91mserver.js::createServer:', + '\x1b[93mserver.js::createServer:', '\x1b[0m/credentials endpoint called, no credentials found' ); res.send('Need to authenticate at localhost:3000/auth'); diff --git a/taskRunner.js b/taskRunner.js index edc9851..a361525 100644 --- a/taskRunner.js +++ b/taskRunner.js @@ -5,8 +5,25 @@ require('dotenv').config(); /** * This file will be responsible for managing the watcher * as well as fetching the credentials from the server + * docker-compose will spawn 4 services from this file, each responsible + * for a different folder (gantry, lathe, mill, waterjet) */ + +// TODO +const projectID = "" + +// parse command line arguments from docker-compose to get folder ID +const folderIdMap = { + gantry: "GANTRY_FOLDER_ID", + lathe: "LATHE_FOLDER_ID", + mill: "MILL_FOLDER_ID", + waterjet: "WATERJET_FOLDER_ID" +}; + +const folderID = folderIdMap[process.argv[2]]; +console.log(folderID); + const adminProjectID = 'a.YnVzaW5lc3M6cHVyZHVlMjY5NiMyMDIxMTEwODQ2NDQzMzk3Ng'; const adminProjectTopFolder = 'urn:adsk.wipprod:fs.folder:co.ltuYad4ZTtieJLm6j3MGuA'; @@ -54,8 +71,6 @@ const fetchToken = () => { * Manages intervals involving getting token from auth server */ const getCredentials = () => { - fetchToken(); - // on initialization, will wait for credentials from server on 10 sec interval initInterval = setInterval(() => { fetchToken();