Merge pull request #786 from Budibase/bug/local-forbidden
Local forbidden issue
This commit is contained in:
commit
1365f42fd5
|
@ -3,6 +3,7 @@ const authenticated = require("../middleware/authenticated")
|
||||||
const compress = require("koa-compress")
|
const compress = require("koa-compress")
|
||||||
const zlib = require("zlib")
|
const zlib = require("zlib")
|
||||||
const { budibaseAppsDir } = require("../utilities/budibaseDir")
|
const { budibaseAppsDir } = require("../utilities/budibaseDir")
|
||||||
|
const { isDev } = require("../utilities")
|
||||||
const {
|
const {
|
||||||
authRoutes,
|
authRoutes,
|
||||||
pageRoutes,
|
pageRoutes,
|
||||||
|
@ -45,10 +46,7 @@ router
|
||||||
jwtSecret: env.JWT_SECRET,
|
jwtSecret: env.JWT_SECRET,
|
||||||
useAppRootPath: true,
|
useAppRootPath: true,
|
||||||
}
|
}
|
||||||
ctx.isDev =
|
ctx.isDev = isDev()
|
||||||
process.env.NODE_ENV !== "production" &&
|
|
||||||
process.env.NODE_ENV !== "jest" &&
|
|
||||||
process.env.NODE_ENV !== "cypress"
|
|
||||||
await next()
|
await next()
|
||||||
})
|
})
|
||||||
.use("/health", ctx => (ctx.status = 200))
|
.use("/health", ctx => (ctx.status = 200))
|
||||||
|
|
|
@ -1,3 +1,17 @@
|
||||||
|
const { resolve, join } = require("./utilities/centralPath")
|
||||||
|
const { homedir } = require("os")
|
||||||
|
const { app } = require("electron")
|
||||||
|
|
||||||
|
let LOADED = false
|
||||||
|
|
||||||
|
if (!LOADED) {
|
||||||
|
const homeDir = app ? app.getPath("home") : homedir()
|
||||||
|
const budibaseDir = join(homeDir, ".budibase")
|
||||||
|
process.env.BUDIBASE_DIR = budibaseDir
|
||||||
|
require("dotenv").config({ path: resolve(budibaseDir, ".env") })
|
||||||
|
LOADED = true
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
CLIENT_ID: process.env.CLIENT_ID,
|
CLIENT_ID: process.env.CLIENT_ID,
|
||||||
NODE_ENV: process.env.NODE_ENV,
|
NODE_ENV: process.env.NODE_ENV,
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
const { resolve, join } = require("./utilities/centralPath")
|
const { budibaseTempDir } = require("./utilities/budibaseDir")
|
||||||
const { homedir } = require("os")
|
const { isDev } = require("./utilities")
|
||||||
const { app } = require("electron")
|
|
||||||
const fixPath = require("fix-path")
|
const fixPath = require("fix-path")
|
||||||
|
const fs = require("fs")
|
||||||
|
|
||||||
async function runServer() {
|
async function runServer() {
|
||||||
const homeDir = app ? app.getPath("home") : homedir()
|
if (isDev() && !fs.existsSync(budibaseTempDir())) {
|
||||||
|
console.error(
|
||||||
const budibaseDir = join(homeDir, ".budibase")
|
"Please run a build before attempting to run server independently to fill 'tmp' directory."
|
||||||
process.env.BUDIBASE_DIR = budibaseDir
|
)
|
||||||
|
process.exit(-1)
|
||||||
|
}
|
||||||
|
|
||||||
fixPath()
|
fixPath()
|
||||||
|
|
||||||
require("dotenv").config({ path: resolve(budibaseDir, ".env") })
|
|
||||||
|
|
||||||
require("./app")
|
require("./app")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1 +1,9 @@
|
||||||
exports.wait = ms => new Promise(resolve => setTimeout(resolve, ms))
|
exports.wait = ms => new Promise(resolve => setTimeout(resolve, ms))
|
||||||
|
|
||||||
|
exports.isDev = () => {
|
||||||
|
return (
|
||||||
|
process.env.NODE_ENV !== "production" &&
|
||||||
|
process.env.NODE_ENV !== "jest" &&
|
||||||
|
process.env.NODE_ENV !== "cypress"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue