From cdbc3fd298e2a581773448bdddcad93de3b3544d Mon Sep 17 00:00:00 2001 From: Yury Shkoda Date: Thu, 7 Oct 2021 07:29:05 +0000 Subject: [PATCH 1/2] fix(executor): create tmp files before execution --- package.json | 3 ++- src/controllers/sas.ts | 6 +++++- src/server.ts | 8 +++++--- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 2981f52..f41cdaf 100644 --- a/package.json +++ b/package.json @@ -39,6 +39,7 @@ "typescript": "^4.3.2" }, "configuration": { - "sasPath": "C:\\Program Files\\SASHome\\SASFoundation\\9.4\\sas.exe" + "sasPath": "/opt/sas/sas9/SASHome/SASFoundation/9.4/sasexe/sas", + "sasJsPort": 5001 } } diff --git a/src/controllers/sas.ts b/src/controllers/sas.ts index 7425d03..afdd4dc 100644 --- a/src/controllers/sas.ts +++ b/src/controllers/sas.ts @@ -28,11 +28,15 @@ export const processSas = async (query: ExecutionQuery): Promise => { generateUniqueFileName(sasFile.replace(/\.sas/g, ''), '.log') ) + await createFile(sasLogPath, '') + const sasWeboutPath = path.join( getTmpWeboutFolderPath(), - generateUniqueFileName(sasFile.replace(/\.sas/g, ''), '.json') + generateUniqueFileName(sasFile.replace(/\.sas/g, ''), '.txt') ) + await createFile(sasWeboutPath, '') + let sasCode = await readFile(sasCodePath) const vars: any = query diff --git a/src/server.ts b/src/server.ts index 4b63253..aa3867e 100644 --- a/src/server.ts +++ b/src/server.ts @@ -1,6 +1,8 @@ import app from './app' +import { configuration } from '../package.json' -const port = 5000 -const listener = app.listen(port, () => { - console.log(`⚡️[server]: Server is running at http://localhost:${port}`) +app.listen(configuration.sasJsPort, () => { + console.log( + `⚡️[server]: Server is running at http://localhost:${configuration.sasJsPort}` + ) }) From c27421cda69c8700786c1d1a883cea33c03e56ab Mon Sep 17 00:00:00 2001 From: Yury Shkoda Date: Thu, 7 Oct 2021 07:57:42 +0000 Subject: [PATCH 2/2] docs(readme): add configuration instructions --- README.md | 7 +++++++ package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 8af0c54..94b3e31 100644 --- a/README.md +++ b/README.md @@ -1 +1,8 @@ # @sasjs/server + +## Configuration + +In order to configure `@sasjs/server`, add the following information to the `configuration` section of `package.json`: + +- Provide path to SAS9 executable. +- Provide `@sasjs/server` desired port. diff --git a/package.json b/package.json index f41cdaf..708bbde 100644 --- a/package.json +++ b/package.json @@ -40,6 +40,6 @@ }, "configuration": { "sasPath": "/opt/sas/sas9/SASHome/SASFoundation/9.4/sasexe/sas", - "sasJsPort": 5001 + "sasJsPort": 5000 } }