generated from bitfocus/companion-module-template-js
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathupgrades.js
More file actions
33 lines (33 loc) · 875 Bytes
/
upgrades.js
File metadata and controls
33 lines (33 loc) · 875 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
module.exports = [
/*
* Place your upgrade scripts here
* Remember that once it has been added it cannot be removed!
*/
function addPort(context, props) {
var result = {
updatedConfig: null,
updatedActions: [],
updatedFeedbacks: [],
}
if (props.config !== null && !props.config.port) {
result.updatedConfig = props.config
result.updatedConfig.port = 1515
}
console.log(JSON.stringify(result))
return result
},
function addId(context, props) {
var result = {
updatedConfig: null,
updatedActions: [],
updatedFeedbacks: [],
}
if (props.config !== null && (props.config.id == undefined || props.config.id == '')) {
result.updatedConfig = props.config
// Set ID to 1 on upgrade for backwards compatibility with original module
result.updatedConfig.id = 1
}
console.log(JSON.stringify(result))
return result
},
]