Merge pull request #12970 from Budibase/disable-schema-dumping-in-cloud
Disable schema dumping for Postgres in Budicloud.
This commit is contained in:
commit
73b94cb389
2 changed files with 20 additions and 1 deletions
|
@ -12,12 +12,16 @@
|
||||||
import PromptQueryModal from "./_components/PromptQueryModal.svelte"
|
import PromptQueryModal from "./_components/PromptQueryModal.svelte"
|
||||||
import SettingsPanel from "./_components/panels/Settings.svelte"
|
import SettingsPanel from "./_components/panels/Settings.svelte"
|
||||||
import { helpers } from "@budibase/shared-core"
|
import { helpers } from "@budibase/shared-core"
|
||||||
|
import { admin } from "stores/portal"
|
||||||
|
import { IntegrationTypes } from "constants/backend"
|
||||||
|
|
||||||
let selectedPanel = null
|
let selectedPanel = null
|
||||||
let panelOptions = []
|
let panelOptions = []
|
||||||
|
|
||||||
$: datasource = $datasources.selected
|
$: datasource = $datasources.selected
|
||||||
|
|
||||||
|
$: isCloud = $admin.cloud
|
||||||
|
$: isPostgres = datasource?.source === IntegrationTypes.POSTGRES
|
||||||
$: getOptions(datasource)
|
$: getOptions(datasource)
|
||||||
|
|
||||||
const getOptions = datasource => {
|
const getOptions = datasource => {
|
||||||
|
@ -41,9 +45,15 @@
|
||||||
}
|
}
|
||||||
// always the last option for SQL
|
// always the last option for SQL
|
||||||
if (helpers.isSQL(datasource)) {
|
if (helpers.isSQL(datasource)) {
|
||||||
|
if (isCloud && isPostgres) {
|
||||||
|
// We don't show the settings panel for Postgres on Budicloud because
|
||||||
|
// it requires pg_dump to work and we don't want to enable shell injection
|
||||||
|
// attacks.
|
||||||
|
} else {
|
||||||
panelOptions.push("Settings")
|
panelOptions.push("Settings")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<PromptQueryModal />
|
<PromptQueryModal />
|
||||||
|
|
|
@ -29,6 +29,7 @@ import { Client, ClientConfig, types } from "pg"
|
||||||
import { getReadableErrorMessage } from "./base/errorMapping"
|
import { getReadableErrorMessage } from "./base/errorMapping"
|
||||||
import { exec } from "child_process"
|
import { exec } from "child_process"
|
||||||
import { storeTempFile } from "../utilities/fileSystem"
|
import { storeTempFile } from "../utilities/fileSystem"
|
||||||
|
import { env } from "@budibase/backend-core"
|
||||||
|
|
||||||
// Return "date" and "timestamp" types as plain strings.
|
// Return "date" and "timestamp" types as plain strings.
|
||||||
// This lets us reference the original stored timezone.
|
// This lets us reference the original stored timezone.
|
||||||
|
@ -433,6 +434,14 @@ class PostgresIntegration extends Sql implements DatasourcePlus {
|
||||||
}
|
}
|
||||||
|
|
||||||
async getExternalSchema() {
|
async getExternalSchema() {
|
||||||
|
if (!env.SELF_HOSTED) {
|
||||||
|
// This is because it relies on shelling out to pg_dump and we don't want
|
||||||
|
// to enable shell injection attacks.
|
||||||
|
throw new Error(
|
||||||
|
"schema export for Postgres is not supported in Budibase Cloud"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
const dumpCommandParts = [
|
const dumpCommandParts = [
|
||||||
`user=${this.config.user}`,
|
`user=${this.config.user}`,
|
||||||
`host=${this.config.host}`,
|
`host=${this.config.host}`,
|
||||||
|
|
Loading…
Reference in a new issue