Fixes for tests, allow any handlebars for datasources (dynamic vars).
This commit is contained in:
parent
3a40a64d15
commit
fec16e23a0
|
@ -152,10 +152,6 @@ export async function update(ctx: UserCtx) {
|
||||||
const auth = datasource.config?.auth
|
const auth = datasource.config?.auth
|
||||||
await invalidateVariables(datasource, ctx.request.body)
|
await invalidateVariables(datasource, ctx.request.body)
|
||||||
|
|
||||||
if (!sdk.datasources.isValid(datasource)) {
|
|
||||||
ctx.throw(400, "Environment variables binding format incorrect")
|
|
||||||
}
|
|
||||||
|
|
||||||
const isBudibaseSource = datasource.type === dbCore.BUDIBASE_DATASOURCE_TYPE
|
const isBudibaseSource = datasource.type === dbCore.BUDIBASE_DATASOURCE_TYPE
|
||||||
|
|
||||||
const dataSourceBody = isBudibaseSource
|
const dataSourceBody = isBudibaseSource
|
||||||
|
@ -198,10 +194,6 @@ export async function save(ctx: UserCtx) {
|
||||||
...ctx.request.body.datasource,
|
...ctx.request.body.datasource,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!sdk.datasources.isValid(datasource)) {
|
|
||||||
ctx.throw(400, "Environment variables binding format incorrect")
|
|
||||||
}
|
|
||||||
|
|
||||||
let schemaError = null
|
let schemaError = null
|
||||||
if (fetchSchema) {
|
if (fetchSchema) {
|
||||||
const { tables, error } = await buildSchemaHelper(datasource)
|
const { tables, error } = await buildSchemaHelper(datasource)
|
||||||
|
|
|
@ -47,14 +47,6 @@ export async function getWithEnvVars(datasourceId: string) {
|
||||||
return enrichDatasourceWithValues(datasource)
|
return enrichDatasourceWithValues(datasource)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isValid(datasource: Datasource) {
|
|
||||||
const blocks = findHBSBlocks(JSON.stringify(datasource))
|
|
||||||
const validList = blocks.filter(
|
|
||||||
block => block.includes(ENV_VAR_PREFIX) || block.includes(USER_PREFIX)
|
|
||||||
)
|
|
||||||
return blocks.length === validList.length
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function removeSecrets(datasources: Datasource[]) {
|
export async function removeSecrets(datasources: Datasource[]) {
|
||||||
const definitions = await getDefinitions()
|
const definitions = await getDefinitions()
|
||||||
for (let datasource of datasources) {
|
for (let datasource of datasources) {
|
||||||
|
|
Loading…
Reference in New Issue