aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tools/peertube-get-access-token.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/tools/peertube-get-access-token.ts')
-rw-r--r--server/tools/peertube-get-access-token.ts22
1 files changed, 12 insertions, 10 deletions
diff --git a/server/tools/peertube-get-access-token.ts b/server/tools/peertube-get-access-token.ts
index 6d47d8922..b2c278c48 100644
--- a/server/tools/peertube-get-access-token.ts
+++ b/server/tools/peertube-get-access-token.ts
@@ -10,25 +10,27 @@ program
10 .option('-p, --password <token>', 'Password') 10 .option('-p, --password <token>', 'Password')
11 .parse(process.argv) 11 .parse(process.argv)
12 12
13const options = program.opts()
14
13if ( 15if (
14 !program['url'] || 16 !options.url ||
15 !program['username'] || 17 !options.username ||
16 !program['password'] 18 !options.password
17) { 19) {
18 if (!program['url']) console.error('--url field is required.') 20 if (!options.url) console.error('--url field is required.')
19 if (!program['username']) console.error('--username field is required.') 21 if (!options.username) console.error('--username field is required.')
20 if (!program['password']) console.error('--password field is required.') 22 if (!options.password) console.error('--password field is required.')
21 23
22 process.exit(-1) 24 process.exit(-1)
23} 25}
24 26
25getClient(program.url) 27getClient(options.url)
26 .then(res => { 28 .then(res => {
27 const server = { 29 const server = {
28 url: program['url'], 30 url: options.url,
29 user: { 31 user: {
30 username: program['username'], 32 username: options.username,
31 password: program['password'] 33 password: options.password
32 }, 34 },
33 client: { 35 client: {
34 id: res.body.client_id, 36 id: res.body.client_id,