don't strip secrets from DB and only hide from client

This commit is contained in:
Martin McKeaveney 2022-01-19 10:30:22 +01:00
parent 328aef00e1
commit 875a577561
1 changed files with 5 additions and 0 deletions

View File

@ -101,8 +101,13 @@ exports.update = async function (ctx) {
const db = new CouchDB(ctx.appId)
const datasourceId = ctx.params.datasourceId
let datasource = await db.get(datasourceId)
const auth = datasource.config.auth
await invalidateVariables(datasource, ctx.request.body)
datasource = { ...datasource, ...ctx.request.body }
if (auth && !ctx.request.body.auth) {
// don't strip auth config from DB
datasource.config.auth = auth
}
const response = await db.put(datasource)
datasource._rev = response.rev