2020-07-10 17:17:04 +02:00
|
|
|
const { resolve, join } = require("path")
|
2020-07-13 18:44:13 +02:00
|
|
|
const { homedir } = require("os");
|
|
|
|
const { app } = require("electron");
|
2020-06-15 18:06:54 +02:00
|
|
|
|
|
|
|
async function runServer() {
|
2020-07-13 18:44:13 +02:00
|
|
|
const homeDir = app ? app.getPath("home") : homedir();
|
|
|
|
|
|
|
|
const budibaseDir = join(homeDir, ".budibase")
|
2020-07-10 17:17:04 +02:00
|
|
|
process.env.BUDIBASE_DIR = budibaseDir
|
2020-06-15 18:06:54 +02:00
|
|
|
|
2020-07-10 17:17:04 +02:00
|
|
|
require("dotenv").config({ path: resolve(budibaseDir, ".env") })
|
2020-06-15 18:06:54 +02:00
|
|
|
|
2020-06-15 18:08:59 +02:00
|
|
|
const server = await require("./app")()
|
2020-07-10 17:17:04 +02:00
|
|
|
|
2020-06-15 18:06:54 +02:00
|
|
|
server.on("close", () => console.log("Server Closed"))
|
|
|
|
console.log(`Budibase running on ${JSON.stringify(server.address())}`)
|
|
|
|
}
|
|
|
|
|
2020-06-15 18:08:59 +02:00
|
|
|
runServer()
|