1
0
mirror of https://github.com/sasjs/server.git synced 2026-01-08 07:00:04 +00:00

chore: default is desktop mode with prompts

This commit is contained in:
Saad Jutt
2021-11-12 23:59:55 +05:00
parent 46f2648a95
commit cd738aa4b8
17 changed files with 368 additions and 40 deletions

View File

@@ -9,7 +9,11 @@ import {
authenticateRefreshToken
} from '../../middlewares'
import { authorizeValidation, tokenValidation } from '../../utils'
import {
authorizeValidation,
getDesktopFields,
tokenValidation
} from '../../utils'
import { InfoJWT } from '../../types'
const authRouter = express.Router()
@@ -24,10 +28,16 @@ export const populateClients = async () => {
})
}
export const connectDB = () => {
export const connectDB = async () => {
const { MODE } = process.env
if (MODE?.trim() === 'desktop') {
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
}

View File

@@ -1,5 +1,5 @@
import express from 'express'
import dotenv from 'dotenv'
import swaggerUi from 'swagger-ui-express'
import {
@@ -13,10 +13,7 @@ import stpRouter from './stp'
import userRouter from './user'
import groupRouter from './group'
import clientRouter from './client'
import authRouter, { connectDB } from './auth'
dotenv.config()
connectDB()
import authRouter from './auth'
const router = express.Router()

View File

@@ -9,7 +9,7 @@ webRouter.get('/', async (_, res) => {
const indexHtmlPath = path.join(getWebBuildFolderPath(), 'index.html')
const { MODE } = process.env
if (MODE?.trim() === 'desktop') {
if (MODE?.trim() !== 'server') {
const content = await readFile(indexHtmlPath)
const codeToInject = `