1
0
Fork 0
mirror of synced 2024-06-29 11:31:06 +12:00

Formatting.

This commit is contained in:
mike12345567 2021-02-26 17:09:20 +00:00
parent 3669e59bc3
commit 9b33bbdb3a
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
@ -66,9 +69,13 @@ async function start() {
console.log(info("Starting services, this may take a moment."))
const port = envFile.get("MAIN_PORT")
await handleError(async () => {
await compose.upAll({cwd: "./", log: false})
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 () => {
@ -106,7 +117,7 @@ async function update() {
await compose.stop()
}
console.log(info("Beginning update, this may take a few minutes."))
await compose.pullMany(BUDIBASE_SERVICES, {log: true})
await compose.pullMany(BUDIBASE_SERVICES, { log: true })
if (isUp) {
console.log(success("Update complete, restarting services..."))
await start()

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

@ -25,9 +25,9 @@ exports.string = async (question, defaultString = null) => {
exports.number = async (question, defaultNumber) => {
const config = {
type: "input",
name: "number",
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)