1
0
mirror of https://github.com/sasjs/server.git synced 2025-12-10 19:34:34 +00:00

chore: copy sas exe script extracted common

This commit is contained in:
Saad Jutt
2021-11-16 06:12:22 +05:00
parent 44fe149ed8
commit b20d6ec59c
6 changed files with 36 additions and 55 deletions

View File

@@ -3,6 +3,7 @@ import mongoose from 'mongoose'
import { configuration } from '../../package.json'
import { getDesktopFields } from '.'
import { populateClients } from '../routes/api/auth'
import { fileExists } from '@sasjs/utils'
export const connectDB = async () => {
const { MODE } = process.env
@@ -18,10 +19,13 @@ export const connectDB = async () => {
} else {
const { SAS_EXEC } = process.env
process.sasLoc = SAS_EXEC
? path.join(__dirname, '..', '..', '...', SAS_EXEC)
? path.join(__dirname, '..', '..', '..', SAS_EXEC)
: configuration.sasPath
}
console.log('SAS_EXEC: ', process.sasLoc)
console.log('SAS_EXEC Exists: ', await fileExists(process.sasLoc))
// NOTE: when exporting app.js as agent for supertest
// we should exlcude connecting to the real database
if (process.env.NODE_ENV !== 'test') {