-import type { ChargingStation } from './ChargingStation.js'
import type { ConfigurationKey, ConfigurationKeyType } from '../types/index.js'
import { logger } from '../utils/index.js'
+import type { ChargingStation } from './ChargingStation.js'
interface ConfigurationKeyOptions {
readonly?: boolean
...{
readonly: false,
visible: true,
- reboot: false
+ reboot: false,
},
- ...options
+ ...options,
}
params = { ...{ overwrite: false, save: false }, ...params }
let keyFound = getConfigurationKey(chargingStation, key)
- if (keyFound != null && params.overwrite === true) {
+ if (keyFound != null && params.overwrite) {
deleteConfigurationKey(chargingStation, keyFound.key, {
- save: false
+ save: false,
})
keyFound = undefined
}
readonly: options.readonly!,
value,
visible: options.visible,
- reboot: options.reboot
+ reboot: options.reboot,
})
- params.save === true && chargingStation.saveOcppConfiguration()
+ params.save && chargingStation.saveOcppConfiguration()
} else {
logger.error(
`${chargingStation.logPrefix()} Trying to add an already existing configuration key: %j`,
chargingStation.ocppConfiguration.configurationKey.indexOf(keyFound),
1
)
- params.save === true && chargingStation.saveOcppConfiguration()
+ params.save && chargingStation.saveOcppConfiguration()
return deletedConfigurationKey
}
}