Fixing worker dev script to not overwrite env file everytime.

This commit is contained in:
mike12345567 2021-07-30 15:40:39 +01:00
parent 8bcce17cd7
commit 61de20616f
1 changed files with 21 additions and 19 deletions

View File

@ -4,26 +4,28 @@ const fs = require("fs")
async function init() { async function init() {
const envFilePath = path.join(process.cwd(), ".env") const envFilePath = path.join(process.cwd(), ".env")
const envFileJson = { if (!fs.existsSync(envFilePath)) {
SELF_HOSTED: 1, const envFileJson = {
PORT: 4002, SELF_HOSTED: 1,
CLUSTER_PORT: 10000, PORT: 4002,
JWT_SECRET: "testsecret", CLUSTER_PORT: 10000,
INTERNAL_API_KEY: "budibase", JWT_SECRET: "testsecret",
MINIO_ACCESS_KEY: "budibase", INTERNAL_API_KEY: "budibase",
MINIO_SECRET_KEY: "budibase", MINIO_ACCESS_KEY: "budibase",
REDIS_URL: "localhost:6379", MINIO_SECRET_KEY: "budibase",
REDIS_PASSWORD: "budibase", REDIS_URL: "localhost:6379",
MINIO_URL: "http://localhost:10000/", REDIS_PASSWORD: "budibase",
COUCH_DB_URL: "http://budibase:budibase@localhost:10000/db/", MINIO_URL: "http://localhost:10000/",
// empty string is false COUCH_DB_URL: "http://budibase:budibase@localhost:10000/db/",
MULTI_TENANCY: "", // empty string is false
MULTI_TENANCY: "",
}
let envFile = ""
Object.keys(envFileJson).forEach(key => {
envFile += `${key}=${envFileJson[key]}\n`
})
fs.writeFileSync(envFilePath, envFile)
} }
let envFile = ""
Object.keys(envFileJson).forEach(key => {
envFile += `${key}=${envFileJson[key]}\n`
})
fs.writeFileSync(envFilePath, envFile)
} }
// if more than init required use this to determine the command type // if more than init required use this to determine the command type