Formatting.

This commit is contained in:
mike12345567 2021-02-26 17:09:20 +00:00
parent 47d75ebc2e
commit 735a17c363
5 changed files with 34 additions and 18 deletions

View File

@ -11,7 +11,7 @@ const BUDIBASE_SERVICES = ["app-service", "worker-service"]
const ERROR_FILE = "docker-error.log"
const FILE_URLS = [
"https://raw.githubusercontent.com/Budibase/budibase/master/hosting/docker-compose.yaml",
"https://raw.githubusercontent.com/Budibase/budibase/master/hosting/envoy.yaml"
"https://raw.githubusercontent.com/Budibase/budibase/master/hosting/envoy.yaml",
]
async function downloadFiles() {
@ -24,7 +24,8 @@ async function downloadFiles() {
}
async function checkDockerConfigured() {
const error = "docker/docker-compose has not been installed, please follow instructions at: https://docs.budibase.com/self-hosting/hosting-methods/docker-compose#installing-docker"
const error =
"docker/docker-compose has not been installed, please follow instructions at: https://docs.budibase.com/self-hosting/hosting-methods/docker-compose#installing-docker"
const docker = await lookpath("docker")
const compose = await lookpath("docker-compose")
if (!docker || !compose) {
@ -51,7 +52,9 @@ async function handleError(func) {
async function init() {
await checkDockerConfigured()
const shouldContinue = await confirmation("This will create multiple files in current directory, should continue?")
const shouldContinue = await confirmation(
"This will create multiple files in current directory, should continue?"
)
if (!shouldContinue) {
console.log("Stopping.")
return
@ -68,7 +71,11 @@ async function start() {
await handleError(async () => {
await compose.upAll({ cwd: "./", log: false })
})
console.log(success(`Services started, please go to http://localhost:${port} for next steps.`))
console.log(
success(
`Services started, please go to http://localhost:${port} for next steps.`
)
)
}
async function status() {
@ -94,7 +101,11 @@ async function stop() {
async function update() {
await checkDockerConfigured()
checkInitComplete()
if (await confirmation("Do you wish to update you docker-compose.yaml and envoy.yaml?")) {
if (
await confirmation(
"Do you wish to update you docker-compose.yaml and envoy.yaml?"
)
) {
await downloadFiles()
}
await handleError(async () => {

View File

@ -32,11 +32,20 @@ BUDIBASE_ENVIRONMENT=PRODUCTION`
module.exports.filePath = FILE_PATH
module.exports.make = async () => {
const hostingKey = await string("Please input the password you'd like to use as your hosting key: ")
const hostingPort = await number("Please enter the port on which you want your installation to run: ", 10000)
const hostingKey = await string(
"Please input the password you'd like to use as your hosting key: "
)
const hostingPort = await number(
"Please enter the port on which you want your installation to run: ",
10000
)
const fileContents = getContents(hostingPort, hostingKey)
fs.writeFileSync(FILE_PATH, fileContents)
console.log(success("Configuration has been written successfully - please check .env file for more details."))
console.log(
success(
"Configuration has been written successfully - please check .env file for more details."
)
)
}
module.exports.get = property => {

View File

@ -27,7 +27,7 @@ exports.number = async (question, defaultNumber) => {
type: "input",
name: "number",
message: question,
validate: (value) => {
validate: value => {
let valid = !isNaN(parseFloat(value))
return valid || "Please enter a number"
},

View File

@ -1,8 +1,4 @@
const {
getSubHelpDescription,
getHelpDescription,
error,
} = require("../utils")
const { getSubHelpDescription, getHelpDescription, error } = require("../utils")
class Command {
constructor(command, func = null) {

View File

@ -10,7 +10,7 @@ exports.downloadFile = async (url, filePath) => {
const response = await axios({
url,
method: "GET",
responseType: "stream"
responseType: "stream",
})
response.data.pipe(writer)