mirror of
https://github.com/sasjs/server.git
synced 2025-12-10 19:34:34 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
efacb1e916 | ||
|
|
d19ce253b4 |
@@ -2,6 +2,13 @@
|
|||||||
|
|
||||||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
||||||
|
|
||||||
|
### [0.0.12](https://github.com/sasjs/server/compare/v0.0.11...v0.0.12) (2021-12-15)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* use env if provided for desktop mode ([d19ce25](https://github.com/sasjs/server/commit/d19ce253b4e2d2a7dd912d43a553d4c1bd60ba58))
|
||||||
|
|
||||||
### [0.0.11](https://github.com/sasjs/server/compare/v0.0.10...v0.0.11) (2021-12-15)
|
### [0.0.11](https://github.com/sasjs/server/compare/v0.0.10...v0.0.11) (2021-12-15)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -5,4 +5,7 @@ PORT_WEB=[port for sasjs web component(react)] default value is 3000
|
|||||||
ACCESS_TOKEN_SECRET=<secret>
|
ACCESS_TOKEN_SECRET=<secret>
|
||||||
REFRESH_TOKEN_SECRET=<secret>
|
REFRESH_TOKEN_SECRET=<secret>
|
||||||
AUTH_CODE_SECRET=<secret>
|
AUTH_CODE_SECRET=<secret>
|
||||||
DB_CONNECT=mongodb+srv://<DB_USERNAME>:<DB_PASSWORD>@<CLUSTER>/<DB_NAME>?retryWrites=true&w=majority
|
DB_CONNECT=mongodb+srv://<DB_USERNAME>:<DB_PASSWORD>@<CLUSTER>/<DB_NAME>?retryWrites=true&w=majority
|
||||||
|
|
||||||
|
SAS_PATH=/opt/sas/sas9/SASHome/SASFoundation/9.4/sas
|
||||||
|
SAS_DRIVE=./tmp
|
||||||
|
|||||||
@@ -86,6 +86,6 @@
|
|||||||
"typescript": "^4.3.2"
|
"typescript": "^4.3.2"
|
||||||
},
|
},
|
||||||
"configuration": {
|
"configuration": {
|
||||||
"sasPath": "/opt/sas/sas9/SASHome/SASFoundation/9.4"
|
"sasPath": "/opt/sas/sas9/SASHome/SASFoundation/9.4/sas"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
2
api/src/types/Process.d.ts
vendored
2
api/src/types/Process.d.ts
vendored
@@ -1,7 +1,7 @@
|
|||||||
declare namespace NodeJS {
|
declare namespace NodeJS {
|
||||||
export interface Process {
|
export interface Process {
|
||||||
sasLoc: string
|
sasLoc: string
|
||||||
driveLoc?: string
|
driveLoc: string
|
||||||
sessionController?: import('../controllers/internal').SessionController
|
sessionController?: import('../controllers/internal').SessionController
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,12 +3,14 @@ import mongoose from 'mongoose'
|
|||||||
import { configuration } from '../../package.json'
|
import { configuration } from '../../package.json'
|
||||||
import { getDesktopFields } from '.'
|
import { getDesktopFields } from '.'
|
||||||
import { populateClients } from '../routes/api/auth'
|
import { populateClients } from '../routes/api/auth'
|
||||||
|
import { getRealPath } from '@sasjs/utils'
|
||||||
|
|
||||||
export const connectDB = async () => {
|
export const connectDB = async () => {
|
||||||
// NOTE: when exporting app.js as agent for supertest
|
// NOTE: when exporting app.js as agent for supertest
|
||||||
// we should exlcude connecting to the real database
|
// we should exlcude connecting to the real database
|
||||||
if (process.env.NODE_ENV !== 'test') {
|
if (process.env.NODE_ENV !== 'test') {
|
||||||
const { MODE } = process.env
|
const { MODE } = process.env
|
||||||
|
|
||||||
if (MODE?.trim() !== 'server') {
|
if (MODE?.trim() !== 'server') {
|
||||||
console.log('Running in Destop Mode, no DB to connect.')
|
console.log('Running in Destop Mode, no DB to connect.')
|
||||||
|
|
||||||
@@ -16,16 +18,19 @@ export const connectDB = async () => {
|
|||||||
|
|
||||||
process.sasLoc = sasLoc
|
process.sasLoc = sasLoc
|
||||||
process.driveLoc = driveLoc
|
process.driveLoc = driveLoc
|
||||||
|
} else {
|
||||||
|
const { SAS_PATH, DRIVE_PATH } = process.env
|
||||||
|
|
||||||
return
|
process.sasLoc = SAS_PATH ?? configuration.sasPath
|
||||||
|
process.driveLoc = getRealPath(
|
||||||
|
path.join(process.cwd(), DRIVE_PATH ?? 'tmp')
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
const { SAS_PATH } = process.env
|
|
||||||
const sasDir = SAS_PATH ?? configuration.sasPath
|
|
||||||
|
|
||||||
process.sasLoc = path.join(sasDir, 'sas')
|
|
||||||
|
|
||||||
console.log('sasLoc: ', process.sasLoc)
|
console.log('sasLoc: ', process.sasLoc)
|
||||||
|
console.log('sasDrive: ', process.driveLoc)
|
||||||
|
|
||||||
|
if (MODE?.trim() !== 'server') return
|
||||||
|
|
||||||
mongoose.connect(process.env.DB_CONNECT as string, async (err) => {
|
mongoose.connect(process.env.DB_CONNECT as string, async (err) => {
|
||||||
if (err) throw err
|
if (err) throw err
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import path from 'path'
|
import path from 'path'
|
||||||
import { getRealPath } from '@sasjs/utils'
|
|
||||||
|
|
||||||
export const apiRoot = path.join(__dirname, '..', '..')
|
export const apiRoot = path.join(__dirname, '..', '..')
|
||||||
export const codebaseRoot = path.join(apiRoot, '..')
|
export const codebaseRoot = path.join(apiRoot, '..')
|
||||||
@@ -12,8 +11,7 @@ export const sysInitCompiledPath = path.join(
|
|||||||
export const getWebBuildFolderPath = () =>
|
export const getWebBuildFolderPath = () =>
|
||||||
path.join(codebaseRoot, 'web', 'build')
|
path.join(codebaseRoot, 'web', 'build')
|
||||||
|
|
||||||
export const getTmpFolderPath = () =>
|
export const getTmpFolderPath = () => process.driveLoc
|
||||||
process.driveLoc ?? getRealPath(path.join(process.cwd(), 'tmp'))
|
|
||||||
|
|
||||||
export const getTmpFilesFolderPath = () =>
|
export const getTmpFilesFolderPath = () =>
|
||||||
path.join(getTmpFolderPath(), 'files')
|
path.join(getTmpFolderPath(), 'files')
|
||||||
|
|||||||
@@ -5,8 +5,10 @@ import { createFolder, fileExists, folderExists } from '@sasjs/utils'
|
|||||||
const isWindows = () => process.platform === 'win32'
|
const isWindows = () => process.platform === 'win32'
|
||||||
|
|
||||||
export const getDesktopFields = async () => {
|
export const getDesktopFields = async () => {
|
||||||
const sasLoc = await getSASLocation()
|
const { SAS_PATH, DRIVE_PATH } = process.env
|
||||||
const driveLoc = await getDriveLocation()
|
|
||||||
|
const sasLoc = SAS_PATH ?? (await getSASLocation())
|
||||||
|
const driveLoc = DRIVE_PATH ?? (await getDriveLocation())
|
||||||
|
|
||||||
return { sasLoc, driveLoc }
|
return { sasLoc, driveLoc }
|
||||||
}
|
}
|
||||||
|
|||||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "server",
|
"name": "server",
|
||||||
"version": "0.0.11",
|
"version": "0.0.12",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "server",
|
"name": "server",
|
||||||
"version": "0.0.11",
|
"version": "0.0.12",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"prettier": "^2.3.1",
|
"prettier": "^2.3.1",
|
||||||
"standard-version": "^9.3.2"
|
"standard-version": "^9.3.2"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "server",
|
"name": "server",
|
||||||
"version": "0.0.11",
|
"version": "0.0.12",
|
||||||
"description": "NodeJS wrapper for calling the SAS binary executable",
|
"description": "NodeJS wrapper for calling the SAS binary executable",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"server": "npm run server:prepare && npm run server:start",
|
"server": "npm run server:prepare && npm run server:start",
|
||||||
|
|||||||
Reference in New Issue
Block a user