budi init - removing unnecessary argument

This commit is contained in:
Michael Shanks 2020-05-21 11:55:56 +01:00
parent 4ac94dbf87
commit 35ceb7e01d
2 changed files with 4 additions and 31 deletions

View File

@ -11,13 +11,6 @@ module.exports = {
default: "~/.budibase", default: "~/.budibase",
alias: "d", alias: "d",
}) })
yargs.positional("database", {
type: "string",
describe: "use a local (PouchDB) or remote (CouchDB) database",
alias: "b",
default: "local",
choices: ["local", "remote"],
})
yargs.positional("clientId", { yargs.positional("clientId", {
type: "string", type: "string",
describe: "used to determine the name of the global databse", describe: "used to determine the name of the global databse",
@ -28,7 +21,7 @@ module.exports = {
type: "string", type: "string",
describe: describe:
"connection string for couch db, format: https://username:password@localhost:5984", "connection string for couch db, format: https://username:password@localhost:5984",
alias: "x", alias: "u",
default: "", default: "",
}) })
yargs.positional("quiet", { yargs.positional("quiet", {

View File

@ -14,7 +14,6 @@ const run = async opts => {
try { try {
await ensureAppDir(opts) await ensureAppDir(opts)
await setEnvironmentVariables(opts) await setEnvironmentVariables(opts)
await prompts(opts)
await createClientDatabase(opts) await createClientDatabase(opts)
await createDevEnvFile(opts) await createDevEnvFile(opts)
console.log(chalk.green("Budibase successfully initialised.")) console.log(chalk.green("Budibase successfully initialised."))
@ -24,13 +23,13 @@ const run = async opts => {
} }
const setEnvironmentVariables = async opts => { const setEnvironmentVariables = async opts => {
if (opts.database === "local") { if (opts.couchDbUrl) {
process.env.COUCH_DB_URL = opts.couchDbUrl
} else {
const dataDir = join(opts.dir, ".data") const dataDir = join(opts.dir, ".data")
await ensureDir(dataDir) await ensureDir(dataDir)
process.env.COUCH_DB_URL = process.env.COUCH_DB_URL =
dataDir + (dataDir.endsWith("/") || dataDir.endsWith("\\") ? "" : "/") dataDir + (dataDir.endsWith("/") || dataDir.endsWith("\\") ? "" : "/")
} else {
process.env.COUCH_DB_URL = opts.couchDbUrl
} }
} }
@ -39,25 +38,6 @@ const ensureAppDir = async opts => {
await ensureDir(opts.dir) await ensureDir(opts.dir)
} }
const prompts = async opts => {
const questions = [
{
type: "input",
name: "couchDbUrl",
message:
"CouchDB Connection String (e.g. https://user:password@localhost:5984): ",
validate: function(value) {
return !!value || "Please enter connection string"
},
},
]
if (opts.database === "remote" && !opts.couchDbUrl) {
const answers = await inquirer.prompt(questions)
opts.couchDbUrl = answers.couchDbUrl
}
}
const createClientDatabase = async opts => { const createClientDatabase = async opts => {
// cannot be a top level require as it // cannot be a top level require as it
// will cause environment module to be loaded prematurely // will cause environment module to be loaded prematurely