Skip to content

Commit

Permalink
feat(xo-server/configurePlugin): can update instead of replace existi…
Browse files Browse the repository at this point in the history
…ng config
  • Loading branch information
julien-f committed Jun 30, 2023
1 parent 7d1ecca commit 650d88d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/xo-server/src/xo-mixins/plugins.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Ajv from 'ajv'
import cloneDeep from 'lodash/cloneDeep.js'
import mapToArray from 'lodash/map.js'
import merge from 'lodash/merge.js'
import noop from 'lodash/noop.js'
import { createLogger } from '@xen-orchestra/log'
import { invalidParameters, noSuchObject } from 'xo-common/api-errors.js'
Expand Down Expand Up @@ -183,11 +184,15 @@ export default class {

// Validate the configuration, configure the plugin instance and
// save the new configuration.
async configurePlugin(id, configuration) {
async configurePlugin(id, configuration, mergeWithExisting = false) {
const plugin = this._getRawPlugin(id)
const metadata = await this._getPluginMetadata(id)

if (metadata !== undefined) {
if (mergeWithExisting) {
configuration = merge({}, metadata.configuration, configuration)
}

configuration = sensitiveValues.merge(configuration, metadata.configuration)
}

Expand Down

0 comments on commit 650d88d

Please sign in to comment.