2021-03-29 16:00:40 +02:00
|
|
|
#!/usr/bin/env node
|
|
|
|
const path = require("path")
|
|
|
|
const fs = require("fs")
|
|
|
|
|
|
|
|
async function init() {
|
|
|
|
const envFilePath = path.join(process.cwd(), ".env")
|
2021-08-05 10:59:08 +02:00
|
|
|
if (!fs.existsSync(envFilePath)) {
|
|
|
|
const envFileJson = {
|
|
|
|
SELF_HOSTED: 1,
|
|
|
|
PORT: 4002,
|
|
|
|
CLUSTER_PORT: 10000,
|
|
|
|
JWT_SECRET: "testsecret",
|
|
|
|
INTERNAL_API_KEY: "budibase",
|
|
|
|
MINIO_ACCESS_KEY: "budibase",
|
|
|
|
MINIO_SECRET_KEY: "budibase",
|
|
|
|
REDIS_URL: "localhost:6379",
|
|
|
|
REDIS_PASSWORD: "budibase",
|
2022-01-30 21:25:56 +01:00
|
|
|
MINIO_URL: "http://localhost:4004",
|
2021-08-05 10:59:08 +02:00
|
|
|
COUCH_DB_URL: "http://budibase:budibase@localhost:10000/db/",
|
2021-08-17 15:11:03 +02:00
|
|
|
COUCH_DB_USERNAME: "budibase",
|
|
|
|
COUCH_DB_PASSWORD: "budibase",
|
2021-08-05 10:59:08 +02:00
|
|
|
// empty string is false
|
|
|
|
MULTI_TENANCY: "",
|
2021-09-29 17:55:59 +02:00
|
|
|
DISABLE_ACCOUNT_PORTAL: "",
|
2021-09-20 12:26:19 +02:00
|
|
|
ACCOUNT_PORTAL_URL: "http://localhost:10001",
|
2021-10-04 14:40:50 +02:00
|
|
|
ACCOUNT_PORTAL_API_KEY: "budibase",
|
2021-10-04 12:30:59 +02:00
|
|
|
PLATFORM_URL: "http://localhost:10000",
|
2021-11-04 15:53:03 +01:00
|
|
|
APPS_URL: "http://localhost:4001",
|
2021-08-05 10:59:08 +02:00
|
|
|
}
|
|
|
|
let envFile = ""
|
|
|
|
Object.keys(envFileJson).forEach(key => {
|
|
|
|
envFile += `${key}=${envFileJson[key]}\n`
|
|
|
|
})
|
|
|
|
fs.writeFileSync(envFilePath, envFile)
|
2021-03-29 16:00:40 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// if more than init required use this to determine the command type
|
|
|
|
//const managementCommand = process.argv.slice(2)[0]
|
|
|
|
|
|
|
|
// for now only one command
|
|
|
|
let command = init
|
|
|
|
|
|
|
|
command()
|
|
|
|
.then(() => {
|
|
|
|
console.log("Done! 🎉")
|
|
|
|
})
|
|
|
|
.catch(err => {
|
|
|
|
console.error(
|
|
|
|
"Something went wrong while managing budibase dev worker:",
|
|
|
|
err.message
|
|
|
|
)
|
|
|
|
})
|