diff options
author | Chocobozzz <me@florianbigard.com> | 2023-04-21 15:05:27 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2023-05-09 08:57:34 +0200 |
commit | 1772b383de490cf406fe93ef3aa3a941f6db513c (patch) | |
tree | 7cecc404c8d71951c22079e9bf5180095981b7f9 /packages/peertube-runner/register | |
parent | 118626c8752bee7b05c4e0b668852e1aba2416f1 (diff) | |
download | PeerTube-1772b383de490cf406fe93ef3aa3a941f6db513c.tar.gz PeerTube-1772b383de490cf406fe93ef3aa3a941f6db513c.tar.zst PeerTube-1772b383de490cf406fe93ef3aa3a941f6db513c.zip |
Add peertube runner cli
Diffstat (limited to 'packages/peertube-runner/register')
-rw-r--r-- | packages/peertube-runner/register/index.ts | 1 | ||||
-rw-r--r-- | packages/peertube-runner/register/register.ts | 35 |
2 files changed, 36 insertions, 0 deletions
diff --git a/packages/peertube-runner/register/index.ts b/packages/peertube-runner/register/index.ts new file mode 100644 index 000000000..3d4273ef8 --- /dev/null +++ b/packages/peertube-runner/register/index.ts | |||
@@ -0,0 +1 @@ | |||
export * from './register' | |||
diff --git a/packages/peertube-runner/register/register.ts b/packages/peertube-runner/register/register.ts new file mode 100644 index 000000000..a69390933 --- /dev/null +++ b/packages/peertube-runner/register/register.ts | |||
@@ -0,0 +1,35 @@ | |||
1 | import { IPCClient } from '../shared/ipc' | ||
2 | |||
3 | export async function registerRunner (options: { | ||
4 | url: string | ||
5 | registrationToken: string | ||
6 | runnerName: string | ||
7 | runnerDescription?: string | ||
8 | }) { | ||
9 | const client = new IPCClient() | ||
10 | await client.run() | ||
11 | |||
12 | await client.askRegister(options) | ||
13 | |||
14 | client.stop() | ||
15 | } | ||
16 | |||
17 | export async function unregisterRunner (options: { | ||
18 | url: string | ||
19 | }) { | ||
20 | const client = new IPCClient() | ||
21 | await client.run() | ||
22 | |||
23 | await client.askUnregister(options) | ||
24 | |||
25 | client.stop() | ||
26 | } | ||
27 | |||
28 | export async function listRegistered () { | ||
29 | const client = new IPCClient() | ||
30 | await client.run() | ||
31 | |||
32 | await client.askListRegistered() | ||
33 | |||
34 | client.stop() | ||
35 | } | ||