2021-02-03 17:09:48 +01:00
|
|
|
const cypressConfig = require("../cypress.json")
|
2021-03-24 16:36:13 +01:00
|
|
|
const path = require("path")
|
|
|
|
|
|
|
|
const tmpdir = path.join(require("os").tmpdir(), ".budibase")
|
2020-08-05 16:18:28 +02:00
|
|
|
|
2021-05-25 16:57:38 +02:00
|
|
|
// normal development system
|
|
|
|
const WORKER_PORT = "10002"
|
2021-04-15 17:25:48 +02:00
|
|
|
const MAIN_PORT = cypressConfig.env.PORT
|
2020-08-05 16:18:28 +02:00
|
|
|
process.env.BUDIBASE_API_KEY = "6BE826CB-6B30-4AEC-8777-2E90464633DE"
|
|
|
|
process.env.NODE_ENV = "cypress"
|
2020-09-29 18:28:24 +02:00
|
|
|
process.env.ENABLE_ANALYTICS = "false"
|
2021-04-15 17:25:48 +02:00
|
|
|
process.env.PORT = MAIN_PORT
|
2021-03-24 16:36:13 +01:00
|
|
|
process.env.JWT_SECRET = cypressConfig.env.JWT_SECRET
|
|
|
|
process.env.COUCH_URL = `leveldb://${tmpdir}/.data/`
|
2021-03-24 22:15:14 +01:00
|
|
|
process.env.SELF_HOSTED = 1
|
2021-05-25 16:57:38 +02:00
|
|
|
process.env.WORKER_URL = "http://localhost:10002/"
|
2021-11-16 18:40:31 +01:00
|
|
|
process.env.APPS_URL = `http://localhost:${MAIN_PORT}/`
|
2022-01-30 21:25:56 +01:00
|
|
|
process.env.MINIO_URL = `http://localhost:4004`
|
2021-03-24 22:15:14 +01:00
|
|
|
process.env.MINIO_ACCESS_KEY = "budibase"
|
|
|
|
process.env.MINIO_SECRET_KEY = "budibase"
|
|
|
|
process.env.COUCH_DB_USER = "budibase"
|
|
|
|
process.env.COUCH_DB_PASSWORD = "budibase"
|
2021-06-21 18:13:06 +02:00
|
|
|
process.env.INTERNAL_API_KEY = "budibase"
|
2021-09-14 12:18:02 +02:00
|
|
|
process.env.ALLOW_DEV_AUTOMATIONS = 1
|
2020-08-05 16:18:28 +02:00
|
|
|
|
2020-12-01 15:35:47 +01:00
|
|
|
// Stop info logs polluting test outputs
|
|
|
|
process.env.LOG_LEVEL = "error"
|
|
|
|
|
2022-01-28 19:52:34 +01:00
|
|
|
exports.run = (
|
|
|
|
serverLoc = "../../server/dist",
|
2022-02-01 17:02:44 +01:00
|
|
|
workerLoc = "../../worker/dist"
|
2022-01-28 19:52:34 +01:00
|
|
|
) => {
|
2021-03-23 12:01:33 +01:00
|
|
|
// require("dotenv").config({ path: resolve(dir, ".env") })
|
2021-07-09 18:50:01 +02:00
|
|
|
// don't make this a variable or top level require
|
2020-10-28 12:23:26 +01:00
|
|
|
// it will cause environment module to be loaded prematurely
|
2022-01-28 19:52:34 +01:00
|
|
|
require(serverLoc)
|
2021-04-15 17:25:48 +02:00
|
|
|
process.env.PORT = WORKER_PORT
|
2022-01-28 19:52:34 +01:00
|
|
|
require(workerLoc)
|
2021-04-15 17:25:48 +02:00
|
|
|
// reload main port for rest of system
|
|
|
|
process.env.PORT = MAIN_PORT
|
2020-10-28 12:23:26 +01:00
|
|
|
}
|
|
|
|
|
2022-01-28 19:52:34 +01:00
|
|
|
if (require.main === module) {
|
|
|
|
exports.run()
|
|
|
|
}
|