Skip to content

Commit da9a230

Browse files
authored
Merge pull request #49 from node-red/telemetry
Add usage telemetry question to admin init command
2 parents f92344f + 677bc2a commit da9a230

File tree

4 files changed

+50
-1
lines changed

4 files changed

+50
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
### 4.1.0
2+
3+
- Add telemetry consent to init command @knolleary
4+
15
### 4.0.2
26

37
- Update dependencies @knolleary

lib/commands/init/index.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,30 @@ async function promptSettingsFile(opts) {
9494
return responses;
9595
}
9696

97+
async function promptTelemetry() {
98+
heading("Share Anonymouse Usage Information");
99+
100+
const responses = await prompt([
101+
{
102+
type: 'select',
103+
name: 'telemetryEnabled',
104+
// initial: "Yes",
105+
message: `Node-RED can notify you when there is a new version available.
106+
This ensures you keep up to date with the latest features and fixes.
107+
This requires sending anonymised data back to the Node-RED team.
108+
It does not include any details of your flows or users.
109+
For full information on what information is collected and how it is used,
110+
please see https://nodered.org/docs/telemetry
111+
`,
112+
choices: ['Yes, send my usage data', 'No, do not send my usage data'],
113+
result(value) {
114+
return /Yes/.test(value)
115+
}
116+
}
117+
])
118+
return responses
119+
}
120+
97121
async function promptUser() {
98122
const responses = await prompt([
99123
{
@@ -279,6 +303,9 @@ async function command(argv, result) {
279303

280304
const fileSettings = await promptSettingsFile({userDir});
281305

306+
const telemetryResponses = await promptTelemetry()
307+
config.telemetryEnabled = telemetryResponses.telemetryEnabled ? 'true' : 'false'
308+
282309
const securityResponses = await promptSecurity();
283310
if (securityResponses.adminAuth) {
284311
let adminAuth = {

lib/commands/init/resources/settings.js.mustache

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,7 @@ module.exports = {
276276
* Runtime Settings
277277
* - lang
278278
* - runtimeState
279+
* - telemetry
279280
* - diagnostics
280281
* - logging
281282
* - contextStorage
@@ -313,6 +314,23 @@ module.exports = {
313314
enabled: false,
314315
/** show or hide runtime stop/start options in the node-red editor. Must be set to `false` to hide */
315316
ui: false,
317+
},
318+
telemetry: {
319+
/**
320+
* By default, telemetry is disabled until the user provides consent the first
321+
* time they open the editor.
322+
*
323+
* The following property can be uncommented and set to true/false to enable/disable
324+
* telemetry without seeking further consent in the editor.
325+
* The user can override this setting via the user settings dialog within the editor
326+
*/
327+
{{^telemetryEnabled}}//enabled: true,{{/telemetryEnabled}}
328+
{{#telemetryEnabled}}enabled: {{telemetryEnabled}},{{/telemetryEnabled}}
329+
/**
330+
* If telemetry is enabled, the editor will notify the user if a new version of Node-RED
331+
* is available. Set the following property to false to disable this notification.
332+
*/
333+
// updateNotification: true
316334
},
317335
/** Configure the logging output */
318336
logging: {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "node-red-admin",
3-
"version": "4.0.2",
3+
"version": "4.1.0",
44
"description": "The Node-RED admin command line interface",
55
"homepage": "https://nodered.org",
66
"bugs": {

0 commit comments

Comments
 (0)