2021-11-16 18:40:31 +01:00
|
|
|
/******************************************************
|
|
|
|
* This script just makes it easy to re-create *
|
|
|
|
* a cypress like environment for testing the backend *
|
|
|
|
******************************************************/
|
2022-02-22 12:20:58 +01:00
|
|
|
import path from "path"
|
2021-11-16 18:40:31 +01:00
|
|
|
const tmpdir = path.join(require("os").tmpdir(), ".budibase")
|
|
|
|
|
2022-02-23 08:00:57 +01:00
|
|
|
const SERVER_PORT = "4100"
|
|
|
|
const WORKER_PORT = "4200"
|
2021-11-16 18:40:31 +01:00
|
|
|
|
|
|
|
// @ts-ignore
|
|
|
|
process.env.NODE_ENV = "cypress"
|
|
|
|
process.env.ENABLE_ANALYTICS = "false"
|
|
|
|
process.env.JWT_SECRET = "budibase"
|
|
|
|
process.env.COUCH_URL = `leveldb://${tmpdir}/.data/`
|
|
|
|
process.env.SELF_HOSTED = "1"
|
2021-11-16 21:56:24 +01:00
|
|
|
process.env.WORKER_URL = `http://localhost:${WORKER_PORT}/`
|
2022-01-31 16:35:23 +01:00
|
|
|
process.env.MINIO_URL = `http://localhost:4004`
|
2021-11-16 18:40:31 +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"
|
|
|
|
process.env.INTERNAL_API_KEY = "budibase"
|
|
|
|
process.env.ALLOW_DEV_AUTOMATIONS = "1"
|
|
|
|
|
|
|
|
// don't make this a variable or top level require
|
|
|
|
// it will cause environment module to be loaded prematurely
|
2022-02-22 12:20:58 +01:00
|
|
|
|
|
|
|
// override the port with the worker port temporarily
|
2021-11-16 21:56:24 +01:00
|
|
|
process.env.PORT = WORKER_PORT
|
2021-11-16 18:40:31 +01:00
|
|
|
const worker = require("../../worker/src/index")
|
2022-02-22 12:20:58 +01:00
|
|
|
|
|
|
|
// override the port with the server port
|
|
|
|
process.env.PORT = SERVER_PORT
|
|
|
|
const server = require("../src/app")
|