Minor fix for the plugin datasource error that occurred when opening apps in an environment where the datasource no longer exists.
This commit is contained in:
parent
5c675f80d4
commit
68912f8030
|
@ -14,7 +14,6 @@ import { invalidateDynamicVariables } from "../../threads/utils"
|
||||||
import { db as dbCore, context, events } from "@budibase/backend-core"
|
import { db as dbCore, context, events } from "@budibase/backend-core"
|
||||||
import { UserCtx, Datasource, Row } from "@budibase/types"
|
import { UserCtx, Datasource, Row } from "@budibase/types"
|
||||||
import sdk from "../../sdk"
|
import sdk from "../../sdk"
|
||||||
import { mergeConfigs } from "../../sdk/app/datasources/datasources"
|
|
||||||
|
|
||||||
export async function fetch(ctx: UserCtx) {
|
export async function fetch(ctx: UserCtx) {
|
||||||
// Get internal tables
|
// Get internal tables
|
||||||
|
|
|
@ -63,8 +63,12 @@ function useEnvVars(str: any) {
|
||||||
|
|
||||||
export async function removeSecrets(datasources: Datasource[]) {
|
export async function removeSecrets(datasources: Datasource[]) {
|
||||||
const definitions = await getDefinitions()
|
const definitions = await getDefinitions()
|
||||||
|
const finalDatasources = []
|
||||||
for (let datasource of datasources) {
|
for (let datasource of datasources) {
|
||||||
const schema = definitions[datasource.source]
|
const schema = definitions[datasource.source]
|
||||||
|
if (!schema) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
if (datasource.config) {
|
if (datasource.config) {
|
||||||
// strip secrets from response, so they don't show in the network request
|
// strip secrets from response, so they don't show in the network request
|
||||||
if (datasource.config.auth) {
|
if (datasource.config.auth) {
|
||||||
|
@ -93,8 +97,9 @@ export async function removeSecrets(datasources: Datasource[]) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
finalDatasources.push(datasource)
|
||||||
}
|
}
|
||||||
return datasources
|
return finalDatasources
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function removeSecretSingle(datasource: Datasource) {
|
export async function removeSecretSingle(datasource: Datasource) {
|
||||||
|
|
Loading…
Reference in New Issue