diff options
Diffstat (limited to 'server/tools/peertube-get-access-token.ts')
-rw-r--r-- | server/tools/peertube-get-access-token.ts | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/server/tools/peertube-get-access-token.ts b/server/tools/peertube-get-access-token.ts deleted file mode 100644 index 71a4826e8..000000000 --- a/server/tools/peertube-get-access-token.ts +++ /dev/null | |||
@@ -1,34 +0,0 @@ | |||
1 | import { program } from 'commander' | ||
2 | import { assignToken, buildServer } from './shared' | ||
3 | |||
4 | program | ||
5 | .option('-u, --url <url>', 'Server url') | ||
6 | .option('-n, --username <username>', 'Username') | ||
7 | .option('-p, --password <token>', 'Password') | ||
8 | .parse(process.argv) | ||
9 | |||
10 | const options = program.opts() | ||
11 | |||
12 | if ( | ||
13 | !options.url || | ||
14 | !options.username || | ||
15 | !options.password | ||
16 | ) { | ||
17 | if (!options.url) console.error('--url field is required.') | ||
18 | if (!options.username) console.error('--username field is required.') | ||
19 | if (!options.password) console.error('--password field is required.') | ||
20 | |||
21 | process.exit(-1) | ||
22 | } | ||
23 | |||
24 | const server = buildServer(options.url) | ||
25 | |||
26 | assignToken(server, options.username, options.password) | ||
27 | .then(() => { | ||
28 | console.log(server.accessToken) | ||
29 | process.exit(0) | ||
30 | }) | ||
31 | .catch(err => { | ||
32 | console.error(err) | ||
33 | process.exit(-1) | ||
34 | }) | ||