1
0
mirror of https://github.com/sasjs/server.git synced 2026-01-09 15:30:05 +00:00

chore: reverted 4 commits related to copying exe scripts

This commit is contained in:
Saad Jutt
2021-11-17 07:49:02 +05:00
parent b3147ec680
commit 455367f10a
14 changed files with 36 additions and 84 deletions

View File

@@ -1,40 +0,0 @@
import path from 'path'
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
if (MODE?.trim() !== 'server') {
console.log('Running in Destop Mode, no DB to connect.')
const { sasLoc, driveLoc } = await getDesktopFields()
process.sasLoc = sasLoc
process.driveLoc = driveLoc
return
} else {
const { SAS_EXEC } = process.env
process.sasLoc = 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') {
mongoose.connect(process.env.DB_CONNECT as string, async (err) => {
if (err) throw err
console.log('Connected to db!')
await populateClients()
})
}
}