1
0
Fork 0
mirror of synced 2024-05-19 11:53:53 +12:00

Some fixes for CLI to get exporting/importing with different ports working, as well as a fix for access to minio through proxy.

This commit is contained in:
mike12345567 2022-10-26 18:51:58 +01:00
parent 80d4220cb5
commit 406cd53d11
3 changed files with 18 additions and 5 deletions

View file

@ -171,11 +171,13 @@ http {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
proxy_connect_timeout 300;
proxy_http_version 1.1;
proxy_set_header Connection "";
chunked_transfer_encoding off;
proxy_pass http://$minio:9000;
}

View file

@ -16,16 +16,21 @@ exports.exportObjects = async () => {
const path = join(TEMP_DIR, MINIO_DIR)
fs.mkdirSync(path)
let fullList = []
let errorCount = 0
for (let bucket of bucketList) {
const client = ObjectStore(bucket)
try {
await client.headBucket().promise()
} catch (err) {
errorCount++
continue
}
const list = await client.listObjectsV2().promise()
fullList = fullList.concat(list.Contents.map(el => ({ ...el, bucket })))
}
if (errorCount === bucketList.length) {
throw new Error("Unable to access MinIO/S3 - check environment config.")
}
const bar = progressBar(fullList.length)
let count = 0
for (let object of fullList) {

View file

@ -2,17 +2,19 @@ const dotenv = require("dotenv")
const fs = require("fs")
const { string } = require("../questions")
const { getPouch } = require("../core/db")
const { env: environment } = require("@budibase/backend-core")
exports.DEFAULT_COUCH = "http://budibase:budibase@localhost:10000/db/"
exports.DEFAULT_MINIO = "http://localhost:10000/"
exports.TEMP_DIR = ".temp"
exports.COUCH_DIR = "couchdb"
exports.MINIO_DIR = "minio"
const REQUIRED = [
{ value: "MAIN_PORT", default: "10000" },
{ value: "COUCH_DB_URL", default: exports.DEFAULT_COUCH },
{ value: "MINIO_URL", default: exports.DEFAULT_MINIO },
{
value: "COUCH_DB_URL",
default: "http://budibase:budibase@localhost:10000/db/",
},
{ value: "MINIO_URL", default: "http://localhost:10000" },
{ value: "MINIO_ACCESS_KEY" },
{ value: "MINIO_SECRET_KEY" },
]
@ -27,7 +29,7 @@ exports.checkURLs = config => {
] = `http://${username}:${password}@localhost:${mainPort}/db/`
}
if (!config["MINIO_URL"]) {
config["MINIO_URL"] = exports.DEFAULT_MINIO
config["MINIO_URL"] = `http://localhost:${mainPort}/`
}
return config
}
@ -65,6 +67,10 @@ exports.getConfig = async (envFile = true) => {
} else {
config = await exports.askQuestions()
}
// fill out environment
for (let key of Object.keys(config)) {
environment._set(key, config[key])
}
return config
}