@dynamicweb/cli 1.0.15 → 1.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/README.md +244 -171
- package/bin/commands/command.js +88 -88
- package/bin/commands/config.js +54 -54
- package/bin/commands/database.js +65 -71
- package/bin/commands/env.js +174 -155
- package/bin/commands/files.js +378 -300
- package/bin/commands/install.js +64 -63
- package/bin/commands/login.js +228 -218
- package/bin/commands/query.js +99 -101
- package/bin/commands/swift.js +78 -78
- package/bin/downloader.js +66 -66
- package/bin/extractor.js +28 -28
- package/bin/index.js +73 -61
- package/bin/utils.js +112 -125
- package/package.json +51 -42
package/bin/commands/install.js
CHANGED
|
@@ -1,64 +1,65 @@
|
|
|
1
|
-
import fetch from 'node-fetch';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
import { setupEnv, getAgent } from './env.js';
|
|
4
|
-
import { setupUser } from './login.js';
|
|
5
|
-
import { uploadFiles, resolveFilePath } from './files.js';
|
|
6
|
-
|
|
7
|
-
export function installCommand() {
|
|
8
|
-
return {
|
|
9
|
-
command: 'install [filePath]',
|
|
10
|
-
describe: 'Installs the addin on the given path, allowed file extensions are .dll, .nupkg',
|
|
11
|
-
builder: (yargs) => {
|
|
12
|
-
return yargs
|
|
13
|
-
.positional('filePath', {
|
|
14
|
-
describe: 'Path to the file to install'
|
|
15
|
-
})
|
|
16
|
-
.option('queue', {
|
|
17
|
-
alias: 'q',
|
|
18
|
-
type: 'boolean',
|
|
19
|
-
describe: 'Queues the install for next Dynamicweb recycle'
|
|
20
|
-
})
|
|
21
|
-
},
|
|
22
|
-
handler: (argv) => {
|
|
23
|
-
if (argv.verbose) console.info(`Installing file located at :${argv.filePath}`)
|
|
24
|
-
handleInstall(argv)
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
async function handleInstall(argv) {
|
|
30
|
-
let env = await setupEnv(argv);
|
|
31
|
-
let user = await setupUser(argv, env);
|
|
32
|
-
|
|
33
|
-
await
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
let
|
|
40
|
-
|
|
41
|
-
'
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
'
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
console.log(
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
console.log(
|
|
62
|
-
|
|
63
|
-
|
|
1
|
+
import fetch from 'node-fetch';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { setupEnv, getAgent } from './env.js';
|
|
4
|
+
import { setupUser } from './login.js';
|
|
5
|
+
import { uploadFiles, resolveFilePath } from './files.js';
|
|
6
|
+
|
|
7
|
+
export function installCommand() {
|
|
8
|
+
return {
|
|
9
|
+
command: 'install [filePath]',
|
|
10
|
+
describe: 'Installs the addin on the given path, allowed file extensions are .dll, .nupkg',
|
|
11
|
+
builder: (yargs) => {
|
|
12
|
+
return yargs
|
|
13
|
+
.positional('filePath', {
|
|
14
|
+
describe: 'Path to the file to install'
|
|
15
|
+
})
|
|
16
|
+
.option('queue', {
|
|
17
|
+
alias: 'q',
|
|
18
|
+
type: 'boolean',
|
|
19
|
+
describe: 'Queues the install for next Dynamicweb recycle'
|
|
20
|
+
})
|
|
21
|
+
},
|
|
22
|
+
handler: async (argv) => {
|
|
23
|
+
if (argv.verbose) console.info(`Installing file located at :${argv.filePath}`)
|
|
24
|
+
await handleInstall(argv)
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
async function handleInstall(argv) {
|
|
30
|
+
let env = await setupEnv(argv);
|
|
31
|
+
let user = await setupUser(argv, env);
|
|
32
|
+
let resolvedPath = resolveFilePath(argv.filePath);
|
|
33
|
+
await uploadFiles(env, user, [ resolvedPath ], 'System/AddIns/Local', false, true);
|
|
34
|
+
await installAddin(env, user, resolvedPath, argv.queue)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
async function installAddin(env, user, resolvedPath, queue) {
|
|
38
|
+
console.log('Installing addin')
|
|
39
|
+
let filename = path.basename(resolvedPath);
|
|
40
|
+
let data = {
|
|
41
|
+
'Queue': queue,
|
|
42
|
+
'Ids': [
|
|
43
|
+
`${filename.substring(0, filename.lastIndexOf('.')) || filename}|${path.extname(resolvedPath)}`
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
let res = await fetch(`${env.protocol}://${env.host}/Admin/Api/AddinInstall`, {
|
|
47
|
+
method: 'POST',
|
|
48
|
+
body: JSON.stringify(data),
|
|
49
|
+
headers: {
|
|
50
|
+
'Content-Type': 'application/json',
|
|
51
|
+
'Authorization': `Bearer ${user.apiKey}`
|
|
52
|
+
},
|
|
53
|
+
agent: getAgent(env.protocol)
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
if (res.ok) {
|
|
57
|
+
if (env.verbose) console.log(await res.json())
|
|
58
|
+
console.log(`Addin installed`)
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
console.log('Request failed, returned error:')
|
|
62
|
+
console.log(await res.json())
|
|
63
|
+
process.exit(1);
|
|
64
|
+
}
|
|
64
65
|
}
|
package/bin/commands/login.js
CHANGED
|
@@ -1,219 +1,229 @@
|
|
|
1
|
-
import fetch from 'node-fetch';
|
|
2
|
-
import { interactiveEnv, getAgent } from './env.js'
|
|
3
|
-
import { updateConfig, getConfig } from './config.js';
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
export function loginCommand() {
|
|
7
|
-
return {
|
|
8
|
-
command: 'login [user]',
|
|
9
|
-
describe: 'If user is specified, changes the current user to the user specified, otherwise fetches an API-key that will be used to upload files and trigger addin installs, this runs with interactive mode',
|
|
10
|
-
builder: (yargs) => {
|
|
11
|
-
return yargs
|
|
12
|
-
.positional('user', {
|
|
13
|
-
describe: 'user'
|
|
14
|
-
})
|
|
15
|
-
},
|
|
16
|
-
handler: (argv) => handleLogin(argv)
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export async function setupUser(argv, env) {
|
|
21
|
-
let user = {};
|
|
22
|
-
let askLogin = true;
|
|
23
|
-
|
|
24
|
-
if (argv.apiKey) {
|
|
25
|
-
user.apiKey = argv.apiKey;
|
|
26
|
-
askLogin = false;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
if (!user.apiKey && env.users) {
|
|
30
|
-
user = env.users[argv.user] || env.users[env.current
|
|
31
|
-
askLogin = false;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
if (askLogin && argv.host) {
|
|
35
|
-
console.log('Please add an --apiKey to the command as overriding the host requires that.')
|
|
36
|
-
process.exit();
|
|
37
|
-
}
|
|
38
|
-
else if (askLogin) {
|
|
39
|
-
console.log('Current user not set, please login')
|
|
40
|
-
await interactiveLogin(argv, {
|
|
41
|
-
environment: {
|
|
42
|
-
type: 'input',
|
|
43
|
-
default: getConfig()?.current?.env,
|
|
44
|
-
prompt: 'never'
|
|
45
|
-
},
|
|
46
|
-
username: {
|
|
47
|
-
type: 'input'
|
|
48
|
-
},
|
|
49
|
-
password: {
|
|
50
|
-
type: 'password'
|
|
51
|
-
},
|
|
52
|
-
interactive: {
|
|
53
|
-
default: true
|
|
54
|
-
}
|
|
55
|
-
})
|
|
56
|
-
user = env.users[env.current.user];
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
return user;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
async function handleLogin(argv) {
|
|
63
|
-
argv.user ? changeUser(argv) : interactiveLogin(argv, {
|
|
64
|
-
environment: {
|
|
65
|
-
type: 'input',
|
|
66
|
-
default: getConfig()?.current?.env || 'dev',
|
|
67
|
-
prompt: 'if-no-arg'
|
|
68
|
-
},
|
|
69
|
-
username: {
|
|
70
|
-
type: 'input'
|
|
71
|
-
},
|
|
72
|
-
password: {
|
|
73
|
-
type: 'password'
|
|
74
|
-
},
|
|
75
|
-
interactive: {
|
|
76
|
-
default: true
|
|
77
|
-
}
|
|
78
|
-
})
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export async function interactiveLogin(argv, options) {
|
|
82
|
-
if (argv.verbose) console.info('Now logging in')
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
getConfig().env[result.environment].
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
1
|
+
import fetch from 'node-fetch';
|
|
2
|
+
import { interactiveEnv, getAgent } from './env.js'
|
|
3
|
+
import { updateConfig, getConfig } from './config.js';
|
|
4
|
+
import { input, password } from '@inquirer/prompts';
|
|
5
|
+
|
|
6
|
+
export function loginCommand() {
|
|
7
|
+
return {
|
|
8
|
+
command: 'login [user]',
|
|
9
|
+
describe: 'If user is specified, changes the current user to the user specified, otherwise fetches an API-key that will be used to upload files and trigger addin installs, this runs with interactive mode',
|
|
10
|
+
builder: (yargs) => {
|
|
11
|
+
return yargs
|
|
12
|
+
.positional('user', {
|
|
13
|
+
describe: 'user'
|
|
14
|
+
})
|
|
15
|
+
},
|
|
16
|
+
handler: (argv) => handleLogin(argv)
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export async function setupUser(argv, env) {
|
|
21
|
+
let user = {};
|
|
22
|
+
let askLogin = true;
|
|
23
|
+
|
|
24
|
+
if (argv.apiKey) {
|
|
25
|
+
user.apiKey = argv.apiKey;
|
|
26
|
+
askLogin = false;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (!user.apiKey && env.users && (argv.user || env.current?.user)) {
|
|
30
|
+
user = env.users[argv.user] || env.users[env.current?.user];
|
|
31
|
+
askLogin = false;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (askLogin && argv.host) {
|
|
35
|
+
console.log('Please add an --apiKey to the command as overriding the host requires that.')
|
|
36
|
+
process.exit();
|
|
37
|
+
}
|
|
38
|
+
else if (askLogin) {
|
|
39
|
+
console.log('Current user not set, please login')
|
|
40
|
+
await interactiveLogin(argv, {
|
|
41
|
+
environment: {
|
|
42
|
+
type: 'input',
|
|
43
|
+
default: getConfig()?.current?.env,
|
|
44
|
+
prompt: 'never'
|
|
45
|
+
},
|
|
46
|
+
username: {
|
|
47
|
+
type: 'input'
|
|
48
|
+
},
|
|
49
|
+
password: {
|
|
50
|
+
type: 'password'
|
|
51
|
+
},
|
|
52
|
+
interactive: {
|
|
53
|
+
default: true
|
|
54
|
+
}
|
|
55
|
+
})
|
|
56
|
+
user = env.users[env.current.user];
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return user;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
async function handleLogin(argv) {
|
|
63
|
+
argv.user ? changeUser(argv) : await interactiveLogin(argv, {
|
|
64
|
+
environment: {
|
|
65
|
+
type: 'input',
|
|
66
|
+
default: getConfig()?.current?.env || 'dev',
|
|
67
|
+
prompt: 'if-no-arg'
|
|
68
|
+
},
|
|
69
|
+
username: {
|
|
70
|
+
type: 'input'
|
|
71
|
+
},
|
|
72
|
+
password: {
|
|
73
|
+
type: 'password'
|
|
74
|
+
},
|
|
75
|
+
interactive: {
|
|
76
|
+
default: true
|
|
77
|
+
}
|
|
78
|
+
})
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export async function interactiveLogin(argv, options) {
|
|
82
|
+
if (argv.verbose) console.info('Now logging in')
|
|
83
|
+
const result = {};
|
|
84
|
+
for (const [key, config] of Object.entries(options)) {
|
|
85
|
+
if (key === 'interactive') continue;
|
|
86
|
+
if (config.prompt === 'never') {
|
|
87
|
+
result[key] = config.default;
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
const promptFn = config.type === 'password' ? password : input;
|
|
91
|
+
result[key] = await promptFn({
|
|
92
|
+
message: config.describe || key,
|
|
93
|
+
default: config.default,
|
|
94
|
+
mask: config.type === 'password' ? '*' : undefined
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
if (!getConfig().env || !getConfig().env[result.environment] || !getConfig().env[result.environment].host || !getConfig().env[result.environment].protocol) {
|
|
98
|
+
if (!argv.host)
|
|
99
|
+
console.log(`The environment specified is missing parameters, please specify them`)
|
|
100
|
+
await interactiveEnv(argv, {
|
|
101
|
+
environment: {
|
|
102
|
+
type: 'input',
|
|
103
|
+
default: result.environment,
|
|
104
|
+
prompt: 'never'
|
|
105
|
+
},
|
|
106
|
+
host: {
|
|
107
|
+
describe: 'Enter your host including protocol, i.e "https://yourHost.com":',
|
|
108
|
+
type: 'input',
|
|
109
|
+
prompt: 'always'
|
|
110
|
+
},
|
|
111
|
+
interactive: {
|
|
112
|
+
default: true
|
|
113
|
+
}
|
|
114
|
+
})
|
|
115
|
+
}
|
|
116
|
+
await loginInteractive(result, argv.verbose);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
async function loginInteractive(result, verbose) {
|
|
120
|
+
var protocol = getConfig().env[result.environment].protocol;
|
|
121
|
+
var token = await login(result.username, result.password, result.environment, protocol, verbose);
|
|
122
|
+
if (!token) return;
|
|
123
|
+
var apiKey = await getApiKey(token, result.environment, protocol, verbose)
|
|
124
|
+
if (!apiKey) return;
|
|
125
|
+
getConfig().env = getConfig().env || {};
|
|
126
|
+
getConfig().env[result.environment].users = getConfig().env[result.environment].users || {};
|
|
127
|
+
getConfig().env[result.environment].users[result.username] = getConfig().env[result.environment].users[result.username] || {};
|
|
128
|
+
getConfig().env[result.environment].users[result.username].apiKey = apiKey;
|
|
129
|
+
getConfig().env[result.environment].current = getConfig().env[result.environment].current || {};
|
|
130
|
+
getConfig().env[result.environment].current.user = result.username;
|
|
131
|
+
console.log("You're now logged in as " + result.username)
|
|
132
|
+
updateConfig();
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
async function login(username, password, env, protocol, verbose) {
|
|
136
|
+
let data = new URLSearchParams();
|
|
137
|
+
data.append('Username', username);
|
|
138
|
+
data.append('Password', password);
|
|
139
|
+
var res = await fetch(`${protocol}://${getConfig().env[env].host}/Admin/Authentication/Login`, {
|
|
140
|
+
method: 'POST',
|
|
141
|
+
body: data,
|
|
142
|
+
headers: {
|
|
143
|
+
'Content-Type': 'application/x-www-form-urlencoded'
|
|
144
|
+
},
|
|
145
|
+
agent: getAgent(protocol),
|
|
146
|
+
redirect: "manual"
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
if (res.ok || res.status == 302) {
|
|
150
|
+
let user = parseCookies(res.headers.get('set-cookie')).user;
|
|
151
|
+
if (!user) return;
|
|
152
|
+
return await getToken(user, env, protocol, verbose)
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
if (verbose) console.info(res)
|
|
156
|
+
console.log(`Login attempt failed with username ${username}, please verify its a valid user in your Dynamicweb solution.`)
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
function parseCookies (cookieHeader) {
|
|
161
|
+
const list = {};
|
|
162
|
+
if (!cookieHeader) {
|
|
163
|
+
console.log(`Could not get the necessary information from the login request, please verify its a valid user in your Dynamicweb solution.`)
|
|
164
|
+
return list;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
cookieHeader.replace('httponly, ', '').replace('Dynamicweb.Admin', 'user').split(`;`).forEach(cookie => {
|
|
168
|
+
let [ name, ...rest] = cookie.split(`=`);
|
|
169
|
+
name = name?.trim();
|
|
170
|
+
if (!name) return;
|
|
171
|
+
const value = rest.join(`=`).trim();
|
|
172
|
+
if (!value) return;
|
|
173
|
+
list[name] = decodeURIComponent(value);
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
if (!list.user) {
|
|
177
|
+
console.log(`Could not get the necessary information from the login request, please verify its a valid user in your Dynamicweb solution.`)
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
return list;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
async function getToken(user, env, protocol, verbose) {
|
|
184
|
+
var res = await fetch(`${protocol}://${getConfig().env[env].host}/Admin/Authentication/Token`, {
|
|
185
|
+
method: 'GET',
|
|
186
|
+
headers: {
|
|
187
|
+
'cookie': `Dynamicweb.Admin=${user}`
|
|
188
|
+
},
|
|
189
|
+
agent: getAgent(protocol)
|
|
190
|
+
});
|
|
191
|
+
if (res.ok) {
|
|
192
|
+
return (await res.json()).token
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
if (verbose) console.info(res)
|
|
196
|
+
console.log(`Could not fetch the token for the logged in user ${user}, please verify its a valid user in your Dynamicweb solution.`)
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
async function getApiKey(token, env, protocol, verbose) {
|
|
201
|
+
let data = {
|
|
202
|
+
'Name': 'DW CLI',
|
|
203
|
+
'Prefix': 'CLI',
|
|
204
|
+
'Description': 'Auto-generated ApiKey by DW CLI'
|
|
205
|
+
};
|
|
206
|
+
var res = await fetch(`${protocol}://${getConfig().env[env].host}/Admin/Api/ApiKeySave`, {
|
|
207
|
+
method: 'POST',
|
|
208
|
+
body: JSON.stringify( { 'model': data } ),
|
|
209
|
+
headers: {
|
|
210
|
+
'Content-Type': 'application/json',
|
|
211
|
+
'Authorization': `Bearer ${token}`
|
|
212
|
+
},
|
|
213
|
+
agent: getAgent(protocol)
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
if (res.ok) {
|
|
217
|
+
return (await res.json()).message
|
|
218
|
+
}
|
|
219
|
+
else {
|
|
220
|
+
if (verbose) console.info(res)
|
|
221
|
+
console.log(`Could not create an API Key for the logged in user, please verify its a valid user in your Dynamicweb solution.`)
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
async function changeUser(argv) {
|
|
226
|
+
getConfig().env[getConfig().current.env].current.user = argv.user;
|
|
227
|
+
updateConfig();
|
|
228
|
+
console.log(`You're now logged in as ${getConfig().env[getConfig().current.env].current.user}`);
|
|
219
229
|
}
|