@mytmpvpn/mytmpvpn-cli 4.0.0 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/mytmpvpn.js +32 -33
- package/package.json +2 -2
- package/src/mytmpvpn.ts +32 -33
package/dist/mytmpvpn.js
CHANGED
|
@@ -9,10 +9,10 @@ const commander_1 = require("commander");
|
|
|
9
9
|
const log = require("loglevel");
|
|
10
10
|
log.setDefaultLevel("info");
|
|
11
11
|
const vpnlib = require("@mytmpvpn/mytmpvpn-common/models/vpn");
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
12
|
+
const mytmpvpn_client_1 = require("@mytmpvpn/mytmpvpn-client");
|
|
13
|
+
const appconfig = require("@mytmpvpn/mytmpvpn-client/appconfig");
|
|
14
|
+
const userconfig = require("@mytmpvpn/mytmpvpn-client/userconfig");
|
|
15
|
+
const client = require("@mytmpvpn/mytmpvpn-client/client");
|
|
16
16
|
const program = new commander_1.Command();
|
|
17
17
|
function handleError(error, verbose = false) {
|
|
18
18
|
if (error.response) {
|
|
@@ -43,9 +43,9 @@ program
|
|
|
43
43
|
.description('MyTmpVpn CLI')
|
|
44
44
|
.version('0.0.1')
|
|
45
45
|
.option('--verbose', 'Produce more logs')
|
|
46
|
-
.option('--appConfig <file>', 'Path to the application config file',
|
|
47
|
-
.option('--userConfig <file>', 'Path to the user config file',
|
|
48
|
-
.option('--profile <name>', 'Name of the profile in the user config file to use',
|
|
46
|
+
.option('--appConfig <file>', 'Path to the application config file', appconfig.getDefaultAppConfigFile())
|
|
47
|
+
.option('--userConfig <file>', 'Path to the user config file', userconfig.getDefaultUserConfigFile())
|
|
48
|
+
.option('--profile <name>', 'Name of the profile in the user config file to use', userconfig.getDefaultUserProfile());
|
|
49
49
|
program.on('option:verbose', function () {
|
|
50
50
|
log.setDefaultLevel("trace");
|
|
51
51
|
});
|
|
@@ -53,10 +53,10 @@ program.command('list-peanuts-packs')
|
|
|
53
53
|
.description(`Returns the list of peanuts packs you can purchase. A peanuts pack contains a given number of peanuts.`)
|
|
54
54
|
.action((_, command) => {
|
|
55
55
|
const options = command.optsWithGlobals();
|
|
56
|
-
const appConfig =
|
|
56
|
+
const appConfig = appconfig.loadAppConfig(options.appConfig);
|
|
57
57
|
// We don't need authenticated user to call this API
|
|
58
|
-
const
|
|
59
|
-
|
|
58
|
+
const clientImpl = new client.MyTmpVpnClientImpl(appConfig.apiUrl);
|
|
59
|
+
clientImpl.listPeanutsPacks()
|
|
60
60
|
.then(((packs) => {
|
|
61
61
|
log.info(JSON.stringify(packs, null, 2));
|
|
62
62
|
}))
|
|
@@ -67,7 +67,7 @@ program.command('get-peanuts-balance')
|
|
|
67
67
|
.action((_, command) => {
|
|
68
68
|
const options = command.optsWithGlobals();
|
|
69
69
|
log.debug(`Get peanuts balance`);
|
|
70
|
-
|
|
70
|
+
(0, mytmpvpn_client_1.getLoggedInClientFromFiles)({
|
|
71
71
|
appConfigFile: options.appConfig,
|
|
72
72
|
userConfigFile: options.userConfig,
|
|
73
73
|
profileName: options.profile
|
|
@@ -85,10 +85,10 @@ program.command('list-regions')
|
|
|
85
85
|
.description('Returns the list of all regions where vpn can be created')
|
|
86
86
|
.action((_, command) => {
|
|
87
87
|
const options = command.optsWithGlobals();
|
|
88
|
-
const appConfig =
|
|
88
|
+
const appConfig = appconfig.loadAppConfig(options.appConfig);
|
|
89
89
|
// We don't need authenticated user to call this API
|
|
90
|
-
const
|
|
91
|
-
|
|
90
|
+
const clientImpl = new client.MyTmpVpnClientImpl(appConfig.apiUrl);
|
|
91
|
+
clientImpl.listRegions()
|
|
92
92
|
.then(((regions) => {
|
|
93
93
|
log.info(JSON.stringify(regions, null, 2));
|
|
94
94
|
}))
|
|
@@ -98,10 +98,10 @@ program.command('list-regions-detailed')
|
|
|
98
98
|
.description('Returns the detailed list of all regions where vpn can be created')
|
|
99
99
|
.action((_, command) => {
|
|
100
100
|
const options = command.optsWithGlobals();
|
|
101
|
-
const appConfig =
|
|
101
|
+
const appConfig = appconfig.loadAppConfig(options.appConfig);
|
|
102
102
|
// We don't need authenticated user to call this API
|
|
103
|
-
const
|
|
104
|
-
|
|
103
|
+
const clientImpl = new client.MyTmpVpnClientImpl(appConfig.apiUrl);
|
|
104
|
+
clientImpl.listRegionsDetailed()
|
|
105
105
|
.then(((regions) => {
|
|
106
106
|
log.info(JSON.stringify(regions, null, 2));
|
|
107
107
|
}))
|
|
@@ -121,7 +121,7 @@ program.command('create')
|
|
|
121
121
|
const syncStr = options.sync ? "synchronously" : "asynchronously";
|
|
122
122
|
const deleteAfter = options.deleteAfter ? options.deleteAfter : undefined;
|
|
123
123
|
log.debug(`Creating new ${options.type} vpn into ${region} ${syncStr}`);
|
|
124
|
-
|
|
124
|
+
(0, mytmpvpn_client_1.getLoggedInClientFromFiles)({
|
|
125
125
|
appConfigFile: options.appConfig,
|
|
126
126
|
userConfigFile: options.userConfig,
|
|
127
127
|
profileName: options.profile
|
|
@@ -154,7 +154,7 @@ program.command('delete')
|
|
|
154
154
|
const options = command.optsWithGlobals();
|
|
155
155
|
const syncStr = options.sync ? "synchronously" : "asynchronously";
|
|
156
156
|
log.debug(`Deleting vpn ${vpnId} ${syncStr}`);
|
|
157
|
-
|
|
157
|
+
(0, mytmpvpn_client_1.getLoggedInClientFromFiles)({
|
|
158
158
|
appConfigFile: options.appConfig,
|
|
159
159
|
userConfigFile: options.userConfig,
|
|
160
160
|
profileName: options.profile
|
|
@@ -181,7 +181,7 @@ program.command('get')
|
|
|
181
181
|
.argument('<vpnId>', 'vpnId to get information from')
|
|
182
182
|
.action((vpnId, _, command) => {
|
|
183
183
|
const options = command.optsWithGlobals();
|
|
184
|
-
|
|
184
|
+
(0, mytmpvpn_client_1.getLoggedInClientFromFiles)({
|
|
185
185
|
appConfigFile: options.appConfig,
|
|
186
186
|
userConfigFile: options.userConfig,
|
|
187
187
|
profileName: options.profile
|
|
@@ -197,12 +197,12 @@ program.command('download-config')
|
|
|
197
197
|
.description('Download configuration of the given vpn to the given file')
|
|
198
198
|
.argument('<vpnId>', 'vpnId to get config file from')
|
|
199
199
|
.option('--file <file>', 'file where the config should be downloaded to. Default is <vpnId>.conf')
|
|
200
|
-
.option('--path <path>', 'path where the config file should be written to',
|
|
200
|
+
.option('--path <path>', 'path where the config file should be written to', userconfig.getDefaultUserConfigDir())
|
|
201
201
|
.action((vpnId, _, command) => {
|
|
202
202
|
const options = command.optsWithGlobals();
|
|
203
203
|
const file = options.file ? options.file : `${vpnId}.conf`;
|
|
204
204
|
const fullpath = path.join(options.path, file);
|
|
205
|
-
|
|
205
|
+
(0, mytmpvpn_client_1.getLoggedInClientFromFiles)({
|
|
206
206
|
appConfigFile: options.appConfig,
|
|
207
207
|
userConfigFile: options.userConfig,
|
|
208
208
|
profileName: options.profile
|
|
@@ -231,7 +231,7 @@ program.command('list')
|
|
|
231
231
|
.option('--exclude-state [<state>, ...]', 'Comma separated list of states to exclude from', [vpnlib.VpnState.Deleted])
|
|
232
232
|
.action((_, command) => {
|
|
233
233
|
const options = command.optsWithGlobals();
|
|
234
|
-
|
|
234
|
+
(0, mytmpvpn_client_1.getLoggedInClientFromFiles)({
|
|
235
235
|
appConfigFile: options.appConfig,
|
|
236
236
|
userConfigFile: options.userConfig,
|
|
237
237
|
profileName: options.profile
|
|
@@ -266,7 +266,7 @@ program.command('wait')
|
|
|
266
266
|
return;
|
|
267
267
|
}
|
|
268
268
|
log.debug(`Waiting for ${vpnId} state to be (at least) ${state}`);
|
|
269
|
-
|
|
269
|
+
(0, mytmpvpn_client_1.getLoggedInClientFromFiles)({
|
|
270
270
|
appConfigFile: options.appConfig,
|
|
271
271
|
userConfigFile: options.userConfig,
|
|
272
272
|
profileName: options.profile
|
|
@@ -286,20 +286,20 @@ program.command('register')
|
|
|
286
286
|
.argument('<password>', 'a password')
|
|
287
287
|
.action((username, password, _, command) => {
|
|
288
288
|
const options = command.optsWithGlobals();
|
|
289
|
-
var
|
|
289
|
+
var userConfigData;
|
|
290
290
|
if (fs.existsSync(options.userConfig)) {
|
|
291
|
-
|
|
292
|
-
if (
|
|
291
|
+
userConfigData = userconfig.loadUserConfig(options.userConfig);
|
|
292
|
+
if (userConfigData.profiles[options.profile]) {
|
|
293
293
|
handleError(`Profile ${options.profile} already exists in ${options.userConfig}, specify another profile name using --profile`);
|
|
294
294
|
return;
|
|
295
295
|
}
|
|
296
|
-
|
|
296
|
+
userConfigData.profiles[options.profile] = {
|
|
297
297
|
username: username,
|
|
298
298
|
password: password
|
|
299
299
|
};
|
|
300
300
|
}
|
|
301
301
|
else {
|
|
302
|
-
|
|
302
|
+
userConfigData = {
|
|
303
303
|
version: 1,
|
|
304
304
|
profiles: {
|
|
305
305
|
default: {
|
|
@@ -309,7 +309,7 @@ program.command('register')
|
|
|
309
309
|
}
|
|
310
310
|
};
|
|
311
311
|
}
|
|
312
|
-
|
|
312
|
+
(0, mytmpvpn_client_1.registerUser)(options.appConfig, { username, password })
|
|
313
313
|
.then(user => {
|
|
314
314
|
log.info(`Please confirm your identity with the code sent to ${username}`);
|
|
315
315
|
fs.mkdir(path.dirname(options.userConfig), { recursive: true }, (err, path) => {
|
|
@@ -318,7 +318,7 @@ program.command('register')
|
|
|
318
318
|
return;
|
|
319
319
|
}
|
|
320
320
|
log.debug(`Directory: ${path} created`);
|
|
321
|
-
fs.writeFile(options.userConfig, JSON.stringify(
|
|
321
|
+
fs.writeFile(options.userConfig, JSON.stringify(userConfigData, null, 2), (err) => {
|
|
322
322
|
if (err) {
|
|
323
323
|
handleError(err);
|
|
324
324
|
return;
|
|
@@ -336,8 +336,7 @@ program.command('confirm-registration')
|
|
|
336
336
|
.argument('<code>', 'the code received')
|
|
337
337
|
.action((username, code, _, command) => {
|
|
338
338
|
const options = command.optsWithGlobals();
|
|
339
|
-
|
|
340
|
-
.confirmUser(options.appConfig, username, code)
|
|
339
|
+
(0, mytmpvpn_client_1.confirmUser)(options.appConfig, username, code)
|
|
341
340
|
.then(result => {
|
|
342
341
|
log.debug(result);
|
|
343
342
|
log.info(`User ${username} confirmed!`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mytmpvpn/mytmpvpn-cli",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"description": "MyTmpVpn CLI",
|
|
5
5
|
"main": "./dist/mytmpvpn.js",
|
|
6
6
|
"bin": {
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
},
|
|
31
31
|
"license": "GNU GPL",
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@mytmpvpn/mytmpvpn-client": "^5.
|
|
33
|
+
"@mytmpvpn/mytmpvpn-client": "^5.1.2",
|
|
34
34
|
"@mytmpvpn/mytmpvpn-common": "^7.0.0",
|
|
35
35
|
"@typescript-eslint/eslint-plugin": "^6.21.0",
|
|
36
36
|
"commander": "^9.5.0",
|
package/src/mytmpvpn.ts
CHANGED
|
@@ -9,10 +9,10 @@ log.setDefaultLevel("info")
|
|
|
9
9
|
|
|
10
10
|
import * as vpnlib from '@mytmpvpn/mytmpvpn-common/models/vpn'
|
|
11
11
|
import * as peanuts from '@mytmpvpn/mytmpvpn-common/models/peanuts'
|
|
12
|
-
import {
|
|
13
|
-
import
|
|
14
|
-
import * as
|
|
15
|
-
import
|
|
12
|
+
import { confirmUser, getLoggedInClientFromFiles, registerUser } from '@mytmpvpn/mytmpvpn-client'
|
|
13
|
+
import * as appconfig from '@mytmpvpn/mytmpvpn-client/appconfig'
|
|
14
|
+
import * as userconfig from '@mytmpvpn/mytmpvpn-client/userconfig'
|
|
15
|
+
import * as client from '@mytmpvpn/mytmpvpn-client/client'
|
|
16
16
|
|
|
17
17
|
const program = new Command()
|
|
18
18
|
|
|
@@ -44,9 +44,9 @@ program
|
|
|
44
44
|
.description('MyTmpVpn CLI')
|
|
45
45
|
.version('0.0.1')
|
|
46
46
|
.option('--verbose', 'Produce more logs')
|
|
47
|
-
.option('--appConfig <file>', 'Path to the application config file', getDefaultAppConfigFile())
|
|
48
|
-
.option('--userConfig <file>', 'Path to the user config file', getDefaultUserConfigFile())
|
|
49
|
-
.option('--profile <name>', 'Name of the profile in the user config file to use', getDefaultUserProfile())
|
|
47
|
+
.option('--appConfig <file>', 'Path to the application config file', appconfig.getDefaultAppConfigFile())
|
|
48
|
+
.option('--userConfig <file>', 'Path to the user config file', userconfig.getDefaultUserConfigFile())
|
|
49
|
+
.option('--profile <name>', 'Name of the profile in the user config file to use', userconfig.getDefaultUserProfile())
|
|
50
50
|
|
|
51
51
|
program.on('option:verbose', function () {
|
|
52
52
|
log.setDefaultLevel("trace")
|
|
@@ -56,10 +56,10 @@ program.command('list-peanuts-packs')
|
|
|
56
56
|
.description(`Returns the list of peanuts packs you can purchase. A peanuts pack contains a given number of peanuts.`)
|
|
57
57
|
.action((_, command) => {
|
|
58
58
|
const options = command.optsWithGlobals()
|
|
59
|
-
const appConfig = loadAppConfig(options.appConfig)
|
|
59
|
+
const appConfig = appconfig.loadAppConfig(options.appConfig)
|
|
60
60
|
// We don't need authenticated user to call this API
|
|
61
|
-
const
|
|
62
|
-
|
|
61
|
+
const clientImpl = new client.MyTmpVpnClientImpl(appConfig.apiUrl)
|
|
62
|
+
clientImpl.listPeanutsPacks()
|
|
63
63
|
.then(((packs: peanuts.PeanutsPack[]) => {
|
|
64
64
|
log.info(JSON.stringify(packs, null, 2))
|
|
65
65
|
}))
|
|
@@ -71,7 +71,7 @@ program.command('get-peanuts-balance')
|
|
|
71
71
|
.action((_, command) => {
|
|
72
72
|
const options = command.optsWithGlobals()
|
|
73
73
|
log.debug(`Get peanuts balance`)
|
|
74
|
-
|
|
74
|
+
getLoggedInClientFromFiles({
|
|
75
75
|
appConfigFile: options.appConfig,
|
|
76
76
|
userConfigFile: options.userConfig,
|
|
77
77
|
profileName: options.profile
|
|
@@ -90,10 +90,10 @@ program.command('list-regions')
|
|
|
90
90
|
.description('Returns the list of all regions where vpn can be created')
|
|
91
91
|
.action((_, command) => {
|
|
92
92
|
const options = command.optsWithGlobals()
|
|
93
|
-
const appConfig = loadAppConfig(options.appConfig)
|
|
93
|
+
const appConfig = appconfig.loadAppConfig(options.appConfig)
|
|
94
94
|
// We don't need authenticated user to call this API
|
|
95
|
-
const
|
|
96
|
-
|
|
95
|
+
const clientImpl = new client.MyTmpVpnClientImpl(appConfig.apiUrl)
|
|
96
|
+
clientImpl.listRegions()
|
|
97
97
|
.then(((regions: any) => {
|
|
98
98
|
log.info(JSON.stringify(regions, null, 2))
|
|
99
99
|
}))
|
|
@@ -104,10 +104,10 @@ program.command('list-regions-detailed')
|
|
|
104
104
|
.description('Returns the detailed list of all regions where vpn can be created')
|
|
105
105
|
.action((_, command) => {
|
|
106
106
|
const options = command.optsWithGlobals()
|
|
107
|
-
const appConfig = loadAppConfig(options.appConfig)
|
|
107
|
+
const appConfig = appconfig.loadAppConfig(options.appConfig)
|
|
108
108
|
// We don't need authenticated user to call this API
|
|
109
|
-
const
|
|
110
|
-
|
|
109
|
+
const clientImpl = new client.MyTmpVpnClientImpl(appConfig.apiUrl)
|
|
110
|
+
clientImpl.listRegionsDetailed()
|
|
111
111
|
.then(((regions: any) => {
|
|
112
112
|
log.info(JSON.stringify(regions, null, 2))
|
|
113
113
|
}))
|
|
@@ -128,7 +128,7 @@ program.command('create')
|
|
|
128
128
|
const syncStr = options.sync ? "synchronously" : "asynchronously"
|
|
129
129
|
const deleteAfter = options.deleteAfter ? options.deleteAfter : undefined
|
|
130
130
|
log.debug(`Creating new ${options.type} vpn into ${region} ${syncStr}`)
|
|
131
|
-
|
|
131
|
+
getLoggedInClientFromFiles({
|
|
132
132
|
appConfigFile: options.appConfig,
|
|
133
133
|
userConfigFile: options.userConfig,
|
|
134
134
|
profileName: options.profile
|
|
@@ -162,7 +162,7 @@ program.command('delete')
|
|
|
162
162
|
const options = command.optsWithGlobals()
|
|
163
163
|
const syncStr = options.sync ? "synchronously" : "asynchronously"
|
|
164
164
|
log.debug(`Deleting vpn ${vpnId} ${syncStr}`)
|
|
165
|
-
|
|
165
|
+
getLoggedInClientFromFiles({
|
|
166
166
|
appConfigFile: options.appConfig,
|
|
167
167
|
userConfigFile: options.userConfig,
|
|
168
168
|
profileName: options.profile
|
|
@@ -190,7 +190,7 @@ program.command('get')
|
|
|
190
190
|
.argument('<vpnId>', 'vpnId to get information from')
|
|
191
191
|
.action((vpnId, _, command) => {
|
|
192
192
|
const options = command.optsWithGlobals()
|
|
193
|
-
|
|
193
|
+
getLoggedInClientFromFiles({
|
|
194
194
|
appConfigFile: options.appConfig,
|
|
195
195
|
userConfigFile: options.userConfig,
|
|
196
196
|
profileName: options.profile
|
|
@@ -207,12 +207,12 @@ program.command('download-config')
|
|
|
207
207
|
.description('Download configuration of the given vpn to the given file')
|
|
208
208
|
.argument('<vpnId>', 'vpnId to get config file from')
|
|
209
209
|
.option('--file <file>', 'file where the config should be downloaded to. Default is <vpnId>.conf')
|
|
210
|
-
.option('--path <path>', 'path where the config file should be written to', getDefaultUserConfigDir())
|
|
210
|
+
.option('--path <path>', 'path where the config file should be written to', userconfig.getDefaultUserConfigDir())
|
|
211
211
|
.action((vpnId, _, command) => {
|
|
212
212
|
const options = command.optsWithGlobals()
|
|
213
213
|
const file = options.file ? options.file : `${vpnId}.conf`
|
|
214
214
|
const fullpath = path.join(options.path, file)
|
|
215
|
-
|
|
215
|
+
getLoggedInClientFromFiles({
|
|
216
216
|
appConfigFile: options.appConfig,
|
|
217
217
|
userConfigFile: options.userConfig,
|
|
218
218
|
profileName: options.profile
|
|
@@ -242,7 +242,7 @@ program.command('list')
|
|
|
242
242
|
.option('--exclude-state [<state>, ...]', 'Comma separated list of states to exclude from', [vpnlib.VpnState.Deleted])
|
|
243
243
|
.action((_, command) => {
|
|
244
244
|
const options = command.optsWithGlobals()
|
|
245
|
-
|
|
245
|
+
getLoggedInClientFromFiles({
|
|
246
246
|
appConfigFile: options.appConfig,
|
|
247
247
|
userConfigFile: options.userConfig,
|
|
248
248
|
profileName: options.profile
|
|
@@ -278,7 +278,7 @@ program.command('wait')
|
|
|
278
278
|
return
|
|
279
279
|
}
|
|
280
280
|
log.debug(`Waiting for ${vpnId} state to be (at least) ${state}`)
|
|
281
|
-
|
|
281
|
+
getLoggedInClientFromFiles({
|
|
282
282
|
appConfigFile: options.appConfig,
|
|
283
283
|
userConfigFile: options.userConfig,
|
|
284
284
|
profileName: options.profile
|
|
@@ -299,19 +299,19 @@ program.command('register')
|
|
|
299
299
|
.argument('<password>', 'a password')
|
|
300
300
|
.action((username, password, _, command) => {
|
|
301
301
|
const options = command.optsWithGlobals()
|
|
302
|
-
var
|
|
302
|
+
var userConfigData: userconfig.UserConfig
|
|
303
303
|
if (fs.existsSync(options.userConfig)) {
|
|
304
|
-
|
|
305
|
-
if (
|
|
304
|
+
userConfigData = userconfig.loadUserConfig(options.userConfig)
|
|
305
|
+
if (userConfigData.profiles[options.profile]) {
|
|
306
306
|
handleError(`Profile ${options.profile} already exists in ${options.userConfig}, specify another profile name using --profile`)
|
|
307
307
|
return
|
|
308
308
|
}
|
|
309
|
-
|
|
309
|
+
userConfigData.profiles[options.profile] = {
|
|
310
310
|
username: username,
|
|
311
311
|
password: password
|
|
312
312
|
}
|
|
313
313
|
} else {
|
|
314
|
-
|
|
314
|
+
userConfigData = {
|
|
315
315
|
version: 1,
|
|
316
316
|
profiles: {
|
|
317
317
|
default: {
|
|
@@ -321,7 +321,7 @@ program.command('register')
|
|
|
321
321
|
}
|
|
322
322
|
}
|
|
323
323
|
}
|
|
324
|
-
|
|
324
|
+
registerUser(options.appConfig,
|
|
325
325
|
{ username, password })
|
|
326
326
|
.then(user => {
|
|
327
327
|
log.info(`Please confirm your identity with the code sent to ${username}`)
|
|
@@ -331,7 +331,7 @@ program.command('register')
|
|
|
331
331
|
return
|
|
332
332
|
}
|
|
333
333
|
log.debug(`Directory: ${path} created`)
|
|
334
|
-
fs.writeFile(options.userConfig, JSON.stringify(
|
|
334
|
+
fs.writeFile(options.userConfig, JSON.stringify(userConfigData, null, 2), (err) => {
|
|
335
335
|
if (err) {
|
|
336
336
|
handleError(err)
|
|
337
337
|
return
|
|
@@ -351,8 +351,7 @@ program.command('confirm-registration')
|
|
|
351
351
|
.argument('<code>', 'the code received')
|
|
352
352
|
.action((username, code, _, command) => {
|
|
353
353
|
const options = command.optsWithGlobals()
|
|
354
|
-
|
|
355
|
-
.confirmUser(options.appConfig, username, code)
|
|
354
|
+
confirmUser(options.appConfig, username, code)
|
|
356
355
|
.then(result => {
|
|
357
356
|
log.debug(result)
|
|
358
357
|
log.info(`User ${username} confirmed!`)
|