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 ca880c4549
commit 6c6ca18f98
1 changed files with 21 additions and 19 deletions

View File

@ -4,6 +4,7 @@ const fs = require("fs")
async function init() { async function init() {
const envFilePath = path.join(process.cwd(), ".env") const envFilePath = path.join(process.cwd(), ".env")
if (!fs.existsSync(envFilePath)) {
const envFileJson = { const envFileJson = {
SELF_HOSTED: 1, SELF_HOSTED: 1,
PORT: 4002, PORT: 4002,
@ -24,6 +25,7 @@ async function init() {
envFile += `${key}=${envFileJson[key]}\n` envFile += `${key}=${envFileJson[key]}\n`
}) })
fs.writeFileSync(envFilePath, envFile) 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