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:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
@@ -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 = `
|
||||
|
||||
Reference in New Issue
Block a user