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 459c4e6..86c8e0f 100644 --- a/package.json +++ b/package.json @@ -40,6 +40,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": 5000 } } 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}` + ) })