budi init - removing unnecessary argument
This commit is contained in:
parent
4ac94dbf87
commit
35ceb7e01d
|
@ -11,13 +11,6 @@ module.exports = {
|
|||
default: "~/.budibase",
|
||||
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", {
|
||||
type: "string",
|
||||
describe: "used to determine the name of the global databse",
|
||||
|
@ -28,7 +21,7 @@ module.exports = {
|
|||
type: "string",
|
||||
describe:
|
||||
"connection string for couch db, format: https://username:password@localhost:5984",
|
||||
alias: "x",
|
||||
alias: "u",
|
||||
default: "",
|
||||
})
|
||||
yargs.positional("quiet", {
|
||||
|
|
|
@ -14,7 +14,6 @@ const run = async opts => {
|
|||
try {
|
||||
await ensureAppDir(opts)
|
||||
await setEnvironmentVariables(opts)
|
||||
await prompts(opts)
|
||||
await createClientDatabase(opts)
|
||||
await createDevEnvFile(opts)
|
||||
console.log(chalk.green("Budibase successfully initialised."))
|
||||
|
@ -24,13 +23,13 @@ const run = 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")
|
||||
await ensureDir(dataDir)
|
||||
process.env.COUCH_DB_URL =
|
||||
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)
|
||||
}
|
||||
|
||||
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 => {
|
||||
// cannot be a top level require as it
|
||||
// will cause environment module to be loaded prematurely
|
||||
|
|
Loading…
Reference in New Issue