clever-tools 4.4.0 → 4.5.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/bin/clever.js +208 -2128
- package/package.json +33 -25
- package/src/clever-client/auth-bridge.js +0 -9
- package/src/clever-client/drains.js +0 -17
- package/src/clever-client/operators.js +1 -1
- package/src/commands/README.md +65 -0
- package/src/commands/accesslogs/accesslogs.command.js +158 -0
- package/src/commands/accesslogs/accesslogs.docs.md +20 -0
- package/src/commands/{activity.js → activity/activity.command.js} +74 -44
- package/src/commands/activity/activity.docs.md +19 -0
- package/src/commands/addon/addon.args.js +14 -0
- package/src/commands/addon/addon.command.js +7 -0
- package/src/commands/addon/addon.create.command.js +236 -0
- package/src/commands/addon/addon.delete.command.js +32 -0
- package/src/commands/addon/addon.docs.md +156 -0
- package/src/commands/addon/addon.env.command.js +50 -0
- package/src/commands/addon/addon.list.command.js +55 -0
- package/src/commands/addon/addon.providers.command.js +45 -0
- package/src/commands/addon/addon.providers.show.command.js +99 -0
- package/src/commands/addon/addon.rename.command.js +24 -0
- package/src/commands/applications/applications.command.js +59 -0
- package/src/commands/applications/applications.docs.md +31 -0
- package/src/commands/applications/applications.list.command.js +100 -0
- package/src/commands/cancel-deploy/cancel-deploy.command.js +30 -0
- package/src/commands/cancel-deploy/cancel-deploy.docs.md +16 -0
- package/src/commands/config/config.args.js +10 -0
- package/src/commands/config/config.command.js +20 -0
- package/src/commands/config/config.docs.md +86 -0
- package/src/commands/config/config.get.command.js +21 -0
- package/src/commands/config/config.set.command.js +38 -0
- package/src/commands/config/config.update.command.js +88 -0
- package/src/commands/console/console.command.js +31 -0
- package/src/commands/console/console.docs.md +16 -0
- package/src/commands/create/create.command.js +173 -0
- package/src/commands/create/create.docs.md +27 -0
- package/src/commands/{curl.js → curl/curl.command.js} +10 -3
- package/src/commands/curl/curl.docs.md +9 -0
- package/src/commands/database/database.args.js +8 -0
- package/src/commands/database/database.backups.command.js +60 -0
- package/src/commands/database/database.backups.download.command.js +55 -0
- package/src/commands/database/database.command.js +10 -0
- package/src/commands/database/database.docs.md +52 -0
- package/src/commands/delete/delete.command.js +43 -0
- package/src/commands/delete/delete.docs.md +17 -0
- package/src/commands/deploy/deploy.command.js +166 -0
- package/src/commands/deploy/deploy.docs.md +22 -0
- package/src/commands/diag/diag.command.js +136 -0
- package/src/commands/diag/diag.docs.md +15 -0
- package/src/commands/domain/domain.add.command.js +25 -0
- package/src/commands/domain/domain.args.js +8 -0
- package/src/commands/domain/domain.command.js +38 -0
- package/src/commands/domain/domain.diag.command.js +204 -0
- package/src/commands/domain/domain.docs.md +143 -0
- package/src/commands/domain/domain.favourite.command.js +35 -0
- package/src/commands/domain/domain.favourite.set.command.js +24 -0
- package/src/commands/domain/domain.favourite.unset.command.js +23 -0
- package/src/commands/domain/domain.overview.command.js +157 -0
- package/src/commands/domain/domain.rm.command.js +25 -0
- package/src/commands/drain/drain.args.js +8 -0
- package/src/commands/drain/drain.command.js +56 -0
- package/src/commands/drain/drain.create.command.js +128 -0
- package/src/commands/drain/drain.disable.command.js +27 -0
- package/src/commands/drain/drain.docs.md +129 -0
- package/src/commands/drain/drain.enable.command.js +27 -0
- package/src/commands/drain/drain.get.command.js +38 -0
- package/src/commands/drain/drain.remove.command.js +26 -0
- package/src/commands/emails/emails.add.command.js +32 -0
- package/src/commands/emails/emails.args.js +8 -0
- package/src/commands/emails/emails.command.js +35 -0
- package/src/commands/emails/emails.docs.md +79 -0
- package/src/commands/emails/emails.open.command.js +15 -0
- package/src/commands/emails/emails.primary.command.js +29 -0
- package/src/commands/emails/emails.remove-all.command.js +54 -0
- package/src/commands/emails/emails.remove.command.js +25 -0
- package/src/commands/env/env.command.js +77 -0
- package/src/commands/env/env.docs.md +99 -0
- package/src/commands/env/env.import-vars.command.js +45 -0
- package/src/commands/env/env.import.command.js +29 -0
- package/src/commands/env/env.rm.command.js +25 -0
- package/src/commands/env/env.set.command.js +32 -0
- package/src/commands/features/features.args.js +9 -0
- package/src/commands/features/features.command.js +7 -0
- package/src/commands/features/features.disable.command.js +25 -0
- package/src/commands/features/features.docs.md +71 -0
- package/src/commands/features/features.enable.command.js +32 -0
- package/src/commands/features/features.info.command.js +27 -0
- package/src/commands/features/features.list.command.js +49 -0
- package/src/commands/global.args.js +45 -0
- package/src/commands/global.commands.js +461 -0
- package/src/commands/global.options.js +186 -0
- package/src/commands/help/help.command.js +9 -0
- package/src/commands/help/help.docs.md +9 -0
- package/src/commands/k8s/k8s.add-persistent-storage.command.js +39 -0
- package/src/commands/k8s/k8s.args.js +9 -0
- package/src/commands/k8s/k8s.command.js +12 -0
- package/src/commands/k8s/k8s.create.command.js +86 -0
- package/src/commands/k8s/k8s.delete.command.js +40 -0
- package/src/commands/k8s/k8s.docs.md +131 -0
- package/src/commands/k8s/k8s.get-kubeconfig.command.js +32 -0
- package/src/commands/k8s/k8s.get.command.js +43 -0
- package/src/commands/k8s/k8s.list.command.js +38 -0
- package/src/commands/keycloak/keycloak.command.js +17 -0
- package/src/commands/keycloak/keycloak.disable-ng.command.js +13 -0
- package/src/commands/keycloak/keycloak.docs.md +197 -0
- package/src/commands/keycloak/keycloak.enable-ng.command.js +13 -0
- package/src/commands/keycloak/keycloak.get.command.js +17 -0
- package/src/commands/keycloak/keycloak.open.command.js +13 -0
- package/src/commands/keycloak/keycloak.open.logs.command.js +13 -0
- package/src/commands/keycloak/keycloak.open.webui.command.js +13 -0
- package/src/commands/keycloak/keycloak.rebuild.command.js +13 -0
- package/src/commands/keycloak/keycloak.restart.command.js +13 -0
- package/src/commands/keycloak/keycloak.version.check.command.js +17 -0
- package/src/commands/keycloak/keycloak.version.command.js +17 -0
- package/src/commands/keycloak/keycloak.version.update.command.js +17 -0
- package/src/commands/kv/kv.command.js +99 -0
- package/src/commands/kv/kv.docs.md +27 -0
- package/src/commands/link/link.command.js +31 -0
- package/src/commands/link/link.docs.md +22 -0
- package/src/commands/{login.js → login/login.command.js} +44 -22
- package/src/commands/login/login.docs.md +16 -0
- package/src/commands/logout/logout.command.js +15 -0
- package/src/commands/logout/logout.docs.md +9 -0
- package/src/commands/logs/logs.command.js +81 -0
- package/src/commands/logs/logs.docs.md +22 -0
- package/src/commands/make-default/make-default.command.js +17 -0
- package/src/commands/make-default/make-default.docs.md +15 -0
- package/src/commands/matomo/matomo.command.js +17 -0
- package/src/commands/matomo/matomo.docs.md +109 -0
- package/src/commands/matomo/matomo.get.command.js +17 -0
- package/src/commands/matomo/matomo.open.command.js +13 -0
- package/src/commands/matomo/matomo.open.logs.command.js +13 -0
- package/src/commands/matomo/matomo.open.webui.command.js +13 -0
- package/src/commands/matomo/matomo.rebuild.command.js +13 -0
- package/src/commands/matomo/matomo.restart.command.js +13 -0
- package/src/commands/metabase/metabase.command.js +17 -0
- package/src/commands/metabase/metabase.docs.md +169 -0
- package/src/commands/metabase/metabase.get.command.js +17 -0
- package/src/commands/metabase/metabase.open.command.js +13 -0
- package/src/commands/metabase/metabase.open.logs.command.js +13 -0
- package/src/commands/metabase/metabase.open.webui.command.js +13 -0
- package/src/commands/metabase/metabase.rebuild.command.js +13 -0
- package/src/commands/metabase/metabase.restart.command.js +13 -0
- package/src/commands/metabase/metabase.version.check.command.js +17 -0
- package/src/commands/metabase/metabase.version.command.js +17 -0
- package/src/commands/metabase/metabase.version.update.command.js +17 -0
- package/src/commands/ng/ng.args.js +27 -0
- package/src/commands/ng/ng.command.js +45 -0
- package/src/commands/ng/ng.create.command.js +60 -0
- package/src/commands/ng/ng.create.external.command.js +44 -0
- package/src/commands/ng/ng.delete.command.js +22 -0
- package/src/commands/ng/ng.delete.external.command.js +25 -0
- package/src/commands/ng/ng.docs.md +214 -0
- package/src/commands/ng/ng.get-config.command.js +32 -0
- package/src/commands/ng/ng.get.command.js +22 -0
- package/src/commands/ng/ng.link.command.js +25 -0
- package/src/commands/ng/ng.options.js +9 -0
- package/src/commands/ng/ng.search.command.js +22 -0
- package/src/commands/ng/ng.unlink.command.js +25 -0
- package/src/commands/notify-email/notify-email.add.command.js +65 -0
- package/src/commands/notify-email/notify-email.command.js +61 -0
- package/src/commands/notify-email/notify-email.docs.md +60 -0
- package/src/commands/notify-email/notify-email.remove.command.js +24 -0
- package/src/commands/open/open.command.js +24 -0
- package/src/commands/open/open.docs.md +16 -0
- package/src/commands/otoroshi/otoroshi.command.js +17 -0
- package/src/commands/otoroshi/otoroshi.disable-ng.command.js +13 -0
- package/src/commands/otoroshi/otoroshi.docs.md +211 -0
- package/src/commands/otoroshi/otoroshi.enable-ng.command.js +13 -0
- package/src/commands/otoroshi/otoroshi.get-config.command.js +13 -0
- package/src/commands/otoroshi/otoroshi.get.command.js +17 -0
- package/src/commands/otoroshi/otoroshi.open.command.js +13 -0
- package/src/commands/otoroshi/otoroshi.open.logs.command.js +13 -0
- package/src/commands/otoroshi/otoroshi.open.webui.command.js +13 -0
- package/src/commands/otoroshi/otoroshi.rebuild.command.js +13 -0
- package/src/commands/otoroshi/otoroshi.restart.command.js +13 -0
- package/src/commands/otoroshi/otoroshi.version.check.command.js +17 -0
- package/src/commands/otoroshi/otoroshi.version.command.js +17 -0
- package/src/commands/otoroshi/otoroshi.version.update.command.js +17 -0
- package/src/commands/profile/profile.command.js +60 -0
- package/src/commands/profile/profile.docs.md +23 -0
- package/src/commands/profile/profile.open.command.js +12 -0
- package/src/commands/published-config/published-config.command.js +40 -0
- package/src/commands/published-config/published-config.docs.md +77 -0
- package/src/commands/published-config/published-config.import.command.js +29 -0
- package/src/commands/published-config/published-config.rm.command.js +27 -0
- package/src/commands/published-config/published-config.set.command.js +34 -0
- package/src/commands/restart/restart.command.js +77 -0
- package/src/commands/restart/restart.docs.md +21 -0
- package/src/commands/scale/scale.command.js +121 -0
- package/src/commands/scale/scale.docs.md +23 -0
- package/src/commands/service/service.command.js +91 -0
- package/src/commands/service/service.docs.md +104 -0
- package/src/commands/service/service.link-addon.command.js +24 -0
- package/src/commands/service/service.link-app.command.js +23 -0
- package/src/commands/service/service.unlink-addon.command.js +24 -0
- package/src/commands/service/service.unlink-app.command.js +23 -0
- package/src/commands/ssh/ssh.command.js +40 -0
- package/src/commands/ssh/ssh.docs.md +17 -0
- package/src/commands/ssh-keys/ssh-keys.add.command.js +41 -0
- package/src/commands/ssh-keys/ssh-keys.args.js +8 -0
- package/src/commands/ssh-keys/ssh-keys.command.js +50 -0
- package/src/commands/ssh-keys/ssh-keys.docs.md +66 -0
- package/src/commands/ssh-keys/ssh-keys.open.command.js +12 -0
- package/src/commands/ssh-keys/ssh-keys.remove-all.command.js +54 -0
- package/src/commands/ssh-keys/ssh-keys.remove.command.js +26 -0
- package/src/commands/status/status.command.js +122 -0
- package/src/commands/status/status.docs.md +17 -0
- package/src/commands/stop/stop.command.js +23 -0
- package/src/commands/stop/stop.docs.md +16 -0
- package/src/commands/tcp-redirs/tcp-redirs.add.command.js +24 -0
- package/src/commands/tcp-redirs/tcp-redirs.command.js +41 -0
- package/src/commands/tcp-redirs/tcp-redirs.docs.md +71 -0
- package/src/commands/tcp-redirs/tcp-redirs.list-namespaces.command.js +48 -0
- package/src/commands/tcp-redirs/tcp-redirs.options.js +11 -0
- package/src/commands/tcp-redirs/tcp-redirs.remove.command.js +34 -0
- package/src/commands/tokens/tokens.command.js +43 -0
- package/src/commands/tokens/tokens.create.command.js +108 -0
- package/src/commands/tokens/tokens.docs.md +50 -0
- package/src/commands/tokens/tokens.revoke.command.js +25 -0
- package/src/commands/unlink/unlink.command.js +21 -0
- package/src/commands/unlink/unlink.docs.md +15 -0
- package/src/commands/version/version.command.js +13 -0
- package/src/commands/version/version.docs.md +9 -0
- package/src/commands/webhooks/webhooks.add.command.js +51 -0
- package/src/commands/webhooks/webhooks.command.js +57 -0
- package/src/commands/webhooks/webhooks.docs.md +61 -0
- package/src/commands/webhooks/webhooks.remove.command.js +24 -0
- package/src/lib/cliparse-patched.js +192 -0
- package/src/lib/define-argument.js +7 -0
- package/src/lib/define-argument.types.d.ts +23 -0
- package/src/lib/define-command.js +7 -0
- package/src/lib/define-command.types.d.ts +85 -0
- package/src/lib/define-common.types.d.ts +18 -0
- package/src/lib/define-option.js +7 -0
- package/src/lib/define-option.types.d.ts +29 -0
- package/src/lib/get-command-info.js +86 -0
- package/src/lib/get-command-info.types.d.ts +42 -0
- package/src/lib/k8s.js +1 -1
- package/src/lib/zod-utils.js +66 -0
- package/src/models/addon.js +2 -19
- package/src/models/app_configuration.js +0 -30
- package/src/models/application.js +4 -5
- package/src/models/application_configuration.js +5 -23
- package/src/models/domain.js +34 -2
- package/src/models/exit-strategy-option.js +0 -9
- package/src/models/git.js +1 -4
- package/src/models/log-v4.js +15 -4
- package/src/models/log.js +5 -0
- package/src/models/namespaces.js +1 -2
- package/src/models/notification.js +1 -7
- package/src/parsers.js +33 -111
- package/src/command-options.js +0 -55
- package/src/command-promise-handler.js +0 -16
- package/src/commands/accesslogs.js +0 -138
- package/src/commands/addon.js +0 -391
- package/src/commands/applications.js +0 -123
- package/src/commands/cancel-deploy.js +0 -19
- package/src/commands/config.js +0 -47
- package/src/commands/console.js +0 -20
- package/src/commands/create.js +0 -129
- package/src/commands/database.js +0 -73
- package/src/commands/delete.js +0 -24
- package/src/commands/deploy.js +0 -133
- package/src/commands/diag.js +0 -126
- package/src/commands/domain.js +0 -445
- package/src/commands/drain.js +0 -164
- package/src/commands/emails.js +0 -156
- package/src/commands/env.js +0 -124
- package/src/commands/features.js +0 -87
- package/src/commands/k8s.js +0 -193
- package/src/commands/keycloak.js +0 -138
- package/src/commands/kv.js +0 -93
- package/src/commands/link.js +0 -20
- package/src/commands/logout.js +0 -8
- package/src/commands/logs.js +0 -45
- package/src/commands/makeDefault.js +0 -11
- package/src/commands/matomo.js +0 -85
- package/src/commands/metabase.js +0 -112
- package/src/commands/ng.js +0 -202
- package/src/commands/notify-email.js +0 -99
- package/src/commands/open.js +0 -13
- package/src/commands/otoroshi.js +0 -150
- package/src/commands/profile.js +0 -55
- package/src/commands/published-config.js +0 -70
- package/src/commands/restart.js +0 -52
- package/src/commands/scale.js +0 -66
- package/src/commands/service.js +0 -105
- package/src/commands/ssh-keys.js +0 -144
- package/src/commands/ssh.js +0 -20
- package/src/commands/status.js +0 -115
- package/src/commands/stop.js +0 -12
- package/src/commands/tcp-redirs.js +0 -80
- package/src/commands/tokens.js +0 -144
- package/src/commands/unlink.js +0 -14
- package/src/commands/version.js +0 -6
- package/src/commands/webhooks.js +0 -74
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
# 📖 `clever keycloak` command reference
|
|
2
|
+
|
|
3
|
+
> [!NOTE]
|
|
4
|
+
> 🧪 **Experimental**: This command may change or be removed in future versions.
|
|
5
|
+
> Enable with: `clever features enable operators`
|
|
6
|
+
|
|
7
|
+
## ➡️ `clever keycloak` <kbd>Since 3.13.0</kbd>
|
|
8
|
+
|
|
9
|
+
Manage Clever Cloud Keycloak services
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
clever keycloak [options]
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
### ⚙️ Options
|
|
16
|
+
|
|
17
|
+
|Name|Description|
|
|
18
|
+
|---|---|
|
|
19
|
+
|`-F`, `--format` `<format>`|Output format (human, json) (default: human)|
|
|
20
|
+
|
|
21
|
+
## ➡️ `clever keycloak disable-ng` <kbd>Since 3.13.0</kbd>
|
|
22
|
+
|
|
23
|
+
Unlink Keycloak from its Network Group
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
clever keycloak disable-ng <addon-id|addon-name>
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### 📥 Arguments
|
|
30
|
+
|
|
31
|
+
|Name|Description|
|
|
32
|
+
|---|---|
|
|
33
|
+
|`addon-id|addon-name`|Add-on ID (or name, if unambiguous)|
|
|
34
|
+
|
|
35
|
+
## ➡️ `clever keycloak enable-ng` <kbd>Since 3.13.0</kbd>
|
|
36
|
+
|
|
37
|
+
Link Keycloak to a Network Group, used for multi-instances secure communication
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
clever keycloak enable-ng <addon-id|addon-name>
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### 📥 Arguments
|
|
44
|
+
|
|
45
|
+
|Name|Description|
|
|
46
|
+
|---|---|
|
|
47
|
+
|`addon-id|addon-name`|Add-on ID (or name, if unambiguous)|
|
|
48
|
+
|
|
49
|
+
## ➡️ `clever keycloak get` <kbd>Since 3.13.0</kbd>
|
|
50
|
+
|
|
51
|
+
Get information about a deployed Keycloak
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
clever keycloak get <addon-id|addon-name> [options]
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### 📥 Arguments
|
|
58
|
+
|
|
59
|
+
|Name|Description|
|
|
60
|
+
|---|---|
|
|
61
|
+
|`addon-id|addon-name`|Add-on ID (or name, if unambiguous)|
|
|
62
|
+
|
|
63
|
+
### ⚙️ Options
|
|
64
|
+
|
|
65
|
+
|Name|Description|
|
|
66
|
+
|---|---|
|
|
67
|
+
|`-F`, `--format` `<format>`|Output format (human, json) (default: human)|
|
|
68
|
+
|
|
69
|
+
## ➡️ `clever keycloak open` <kbd>Since 3.13.0</kbd>
|
|
70
|
+
|
|
71
|
+
Open the Keycloak dashboard in Clever Cloud Console
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
clever keycloak open <addon-id|addon-name>
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### 📥 Arguments
|
|
78
|
+
|
|
79
|
+
|Name|Description|
|
|
80
|
+
|---|---|
|
|
81
|
+
|`addon-id|addon-name`|Add-on ID (or name, if unambiguous)|
|
|
82
|
+
|
|
83
|
+
## ➡️ `clever keycloak open logs` <kbd>Since 3.13.0</kbd>
|
|
84
|
+
|
|
85
|
+
Open the Keycloak application logs in Clever Cloud Console
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
clever keycloak open logs <addon-id|addon-name>
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### 📥 Arguments
|
|
92
|
+
|
|
93
|
+
|Name|Description|
|
|
94
|
+
|---|---|
|
|
95
|
+
|`addon-id|addon-name`|Add-on ID (or name, if unambiguous)|
|
|
96
|
+
|
|
97
|
+
## ➡️ `clever keycloak open webui` <kbd>Since 3.13.0</kbd>
|
|
98
|
+
|
|
99
|
+
Open the Keycloak admin console in your browser
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
clever keycloak open webui <addon-id|addon-name>
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### 📥 Arguments
|
|
106
|
+
|
|
107
|
+
|Name|Description|
|
|
108
|
+
|---|---|
|
|
109
|
+
|`addon-id|addon-name`|Add-on ID (or name, if unambiguous)|
|
|
110
|
+
|
|
111
|
+
## ➡️ `clever keycloak rebuild` <kbd>Since 3.13.0</kbd>
|
|
112
|
+
|
|
113
|
+
Rebuild Keycloak
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
clever keycloak rebuild <addon-id|addon-name>
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### 📥 Arguments
|
|
120
|
+
|
|
121
|
+
|Name|Description|
|
|
122
|
+
|---|---|
|
|
123
|
+
|`addon-id|addon-name`|Add-on ID (or name, if unambiguous)|
|
|
124
|
+
|
|
125
|
+
## ➡️ `clever keycloak restart` <kbd>Since 3.13.0</kbd>
|
|
126
|
+
|
|
127
|
+
Restart Keycloak
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
clever keycloak restart <addon-id|addon-name>
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### 📥 Arguments
|
|
134
|
+
|
|
135
|
+
|Name|Description|
|
|
136
|
+
|---|---|
|
|
137
|
+
|`addon-id|addon-name`|Add-on ID (or name, if unambiguous)|
|
|
138
|
+
|
|
139
|
+
## ➡️ `clever keycloak version` <kbd>Since 3.13.0</kbd>
|
|
140
|
+
|
|
141
|
+
Check Keycloak deployed version
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
clever keycloak version <addon-id|addon-name> [options]
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### 📥 Arguments
|
|
148
|
+
|
|
149
|
+
|Name|Description|
|
|
150
|
+
|---|---|
|
|
151
|
+
|`addon-id|addon-name`|Add-on ID (or name, if unambiguous)|
|
|
152
|
+
|
|
153
|
+
### ⚙️ Options
|
|
154
|
+
|
|
155
|
+
|Name|Description|
|
|
156
|
+
|---|---|
|
|
157
|
+
|`-F`, `--format` `<format>`|Output format (human, json) (default: human)|
|
|
158
|
+
|
|
159
|
+
## ➡️ `clever keycloak version check` <kbd>Since 3.13.0</kbd>
|
|
160
|
+
|
|
161
|
+
Check Keycloak deployed version
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
clever keycloak version check <addon-id|addon-name> [options]
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### 📥 Arguments
|
|
168
|
+
|
|
169
|
+
|Name|Description|
|
|
170
|
+
|---|---|
|
|
171
|
+
|`addon-id|addon-name`|Add-on ID (or name, if unambiguous)|
|
|
172
|
+
|
|
173
|
+
### ⚙️ Options
|
|
174
|
+
|
|
175
|
+
|Name|Description|
|
|
176
|
+
|---|---|
|
|
177
|
+
|`-F`, `--format` `<format>`|Output format (human, json) (default: human)|
|
|
178
|
+
|
|
179
|
+
## ➡️ `clever keycloak version update` <kbd>Since 3.13.0</kbd>
|
|
180
|
+
|
|
181
|
+
Update Keycloak deployed version
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
clever keycloak version update <addon-id|addon-name> [options]
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### 📥 Arguments
|
|
188
|
+
|
|
189
|
+
|Name|Description|
|
|
190
|
+
|---|---|
|
|
191
|
+
|`addon-id|addon-name`|Add-on ID (or name, if unambiguous)|
|
|
192
|
+
|
|
193
|
+
### ⚙️ Options
|
|
194
|
+
|
|
195
|
+
|Name|Description|
|
|
196
|
+
|---|---|
|
|
197
|
+
|`--target` `<version>`|Target version to upgrade to (e.g.: 24, 2.4, 2.4.1)|
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { defineCommand } from '../../lib/define-command.js';
|
|
2
|
+
import { operatorNgEnable } from '../../lib/operator-commands.js';
|
|
3
|
+
import { addonIdOrNameArg } from '../global.args.js';
|
|
4
|
+
|
|
5
|
+
export const keycloakEnableNgCommand = defineCommand({
|
|
6
|
+
description: 'Link Keycloak to a Network Group, used for multi-instances secure communication',
|
|
7
|
+
since: '3.13.0',
|
|
8
|
+
options: {},
|
|
9
|
+
args: [addonIdOrNameArg],
|
|
10
|
+
async handler(_options, addonIdOrName) {
|
|
11
|
+
await operatorNgEnable('keycloak', addonIdOrName);
|
|
12
|
+
},
|
|
13
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { defineCommand } from '../../lib/define-command.js';
|
|
2
|
+
import { operatorPrint } from '../../lib/operator-commands.js';
|
|
3
|
+
import { addonIdOrNameArg } from '../global.args.js';
|
|
4
|
+
import { humanJsonOutputFormatOption } from '../global.options.js';
|
|
5
|
+
|
|
6
|
+
export const keycloakGetCommand = defineCommand({
|
|
7
|
+
description: 'Get information about a deployed Keycloak',
|
|
8
|
+
since: '3.13.0',
|
|
9
|
+
options: {
|
|
10
|
+
format: humanJsonOutputFormatOption,
|
|
11
|
+
},
|
|
12
|
+
args: [addonIdOrNameArg],
|
|
13
|
+
async handler(options, addonIdOrName) {
|
|
14
|
+
const { format } = options;
|
|
15
|
+
await operatorPrint('keycloak', addonIdOrName, format);
|
|
16
|
+
},
|
|
17
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { defineCommand } from '../../lib/define-command.js';
|
|
2
|
+
import { operatorOpen } from '../../lib/operator-commands.js';
|
|
3
|
+
import { addonIdOrNameArg } from '../global.args.js';
|
|
4
|
+
|
|
5
|
+
export const keycloakOpenCommand = defineCommand({
|
|
6
|
+
description: 'Open the Keycloak dashboard in Clever Cloud Console',
|
|
7
|
+
since: '3.13.0',
|
|
8
|
+
options: {},
|
|
9
|
+
args: [addonIdOrNameArg],
|
|
10
|
+
async handler(_options, addonIdOrName) {
|
|
11
|
+
await operatorOpen('keycloak', addonIdOrName);
|
|
12
|
+
},
|
|
13
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { defineCommand } from '../../lib/define-command.js';
|
|
2
|
+
import { operatorOpenLogs } from '../../lib/operator-commands.js';
|
|
3
|
+
import { addonIdOrNameArg } from '../global.args.js';
|
|
4
|
+
|
|
5
|
+
export const keycloakOpenLogsCommand = defineCommand({
|
|
6
|
+
description: 'Open the Keycloak application logs in Clever Cloud Console',
|
|
7
|
+
since: '3.13.0',
|
|
8
|
+
options: {},
|
|
9
|
+
args: [addonIdOrNameArg],
|
|
10
|
+
async handler(_options, addonIdOrName) {
|
|
11
|
+
await operatorOpenLogs('keycloak', addonIdOrName);
|
|
12
|
+
},
|
|
13
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { defineCommand } from '../../lib/define-command.js';
|
|
2
|
+
import { operatorOpenWebUi } from '../../lib/operator-commands.js';
|
|
3
|
+
import { addonIdOrNameArg } from '../global.args.js';
|
|
4
|
+
|
|
5
|
+
export const keycloakOpenWebuiCommand = defineCommand({
|
|
6
|
+
description: 'Open the Keycloak admin console in your browser',
|
|
7
|
+
since: '3.13.0',
|
|
8
|
+
options: {},
|
|
9
|
+
args: [addonIdOrNameArg],
|
|
10
|
+
async handler(_options, addonIdOrName) {
|
|
11
|
+
await operatorOpenWebUi('keycloak', addonIdOrName);
|
|
12
|
+
},
|
|
13
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { defineCommand } from '../../lib/define-command.js';
|
|
2
|
+
import { operatorRebuild } from '../../lib/operator-commands.js';
|
|
3
|
+
import { addonIdOrNameArg } from '../global.args.js';
|
|
4
|
+
|
|
5
|
+
export const keycloakRebuildCommand = defineCommand({
|
|
6
|
+
description: 'Rebuild Keycloak',
|
|
7
|
+
since: '3.13.0',
|
|
8
|
+
options: {},
|
|
9
|
+
args: [addonIdOrNameArg],
|
|
10
|
+
async handler(_options, addonIdOrName) {
|
|
11
|
+
await operatorRebuild('keycloak', addonIdOrName);
|
|
12
|
+
},
|
|
13
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { defineCommand } from '../../lib/define-command.js';
|
|
2
|
+
import { operatorReboot } from '../../lib/operator-commands.js';
|
|
3
|
+
import { addonIdOrNameArg } from '../global.args.js';
|
|
4
|
+
|
|
5
|
+
export const keycloakRestartCommand = defineCommand({
|
|
6
|
+
description: 'Restart Keycloak',
|
|
7
|
+
since: '3.13.0',
|
|
8
|
+
options: {},
|
|
9
|
+
args: [addonIdOrNameArg],
|
|
10
|
+
async handler(_options, addonIdOrName) {
|
|
11
|
+
await operatorReboot('keycloak', addonIdOrName);
|
|
12
|
+
},
|
|
13
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { defineCommand } from '../../lib/define-command.js';
|
|
2
|
+
import { operatorCheckVersion } from '../../lib/operator-commands.js';
|
|
3
|
+
import { addonIdOrNameArg } from '../global.args.js';
|
|
4
|
+
import { humanJsonOutputFormatOption } from '../global.options.js';
|
|
5
|
+
|
|
6
|
+
export const keycloakVersionCheckCommand = defineCommand({
|
|
7
|
+
description: 'Check Keycloak deployed version',
|
|
8
|
+
since: '3.13.0',
|
|
9
|
+
options: {
|
|
10
|
+
format: humanJsonOutputFormatOption,
|
|
11
|
+
},
|
|
12
|
+
args: [addonIdOrNameArg],
|
|
13
|
+
async handler(options, addonIdOrName) {
|
|
14
|
+
const { format } = options;
|
|
15
|
+
await operatorCheckVersion('keycloak', addonIdOrName, format);
|
|
16
|
+
},
|
|
17
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { defineCommand } from '../../lib/define-command.js';
|
|
2
|
+
import { operatorCheckVersion } from '../../lib/operator-commands.js';
|
|
3
|
+
import { addonIdOrNameArg } from '../global.args.js';
|
|
4
|
+
import { humanJsonOutputFormatOption } from '../global.options.js';
|
|
5
|
+
|
|
6
|
+
export const keycloakVersionCommand = defineCommand({
|
|
7
|
+
description: 'Check Keycloak deployed version',
|
|
8
|
+
since: '3.13.0',
|
|
9
|
+
options: {
|
|
10
|
+
format: humanJsonOutputFormatOption,
|
|
11
|
+
},
|
|
12
|
+
args: [addonIdOrNameArg],
|
|
13
|
+
async handler(options, addonIdOrName) {
|
|
14
|
+
const { format } = options;
|
|
15
|
+
await operatorCheckVersion('keycloak', addonIdOrName, format);
|
|
16
|
+
},
|
|
17
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { defineCommand } from '../../lib/define-command.js';
|
|
2
|
+
import { operatorUpdateVersion } from '../../lib/operator-commands.js';
|
|
3
|
+
import { addonIdOrNameArg } from '../global.args.js';
|
|
4
|
+
import { targetVersionOption } from '../global.options.js';
|
|
5
|
+
|
|
6
|
+
export const keycloakVersionUpdateCommand = defineCommand({
|
|
7
|
+
description: 'Update Keycloak deployed version',
|
|
8
|
+
since: '3.13.0',
|
|
9
|
+
options: {
|
|
10
|
+
target: targetVersionOption,
|
|
11
|
+
},
|
|
12
|
+
args: [addonIdOrNameArg],
|
|
13
|
+
async handler(options, addonIdOrName) {
|
|
14
|
+
const { target } = options;
|
|
15
|
+
await operatorUpdateVersion('keycloak', target, addonIdOrName);
|
|
16
|
+
},
|
|
17
|
+
});
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { getAllEnvVars } from '@clevercloud/client/esm/api/v2/addon.js';
|
|
2
|
+
import Redis from 'ioredis';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
import { defineArgument } from '../../lib/define-argument.js';
|
|
5
|
+
import { defineCommand } from '../../lib/define-command.js';
|
|
6
|
+
import { styleText } from '../../lib/style-text.js';
|
|
7
|
+
import { Logger } from '../../logger.js';
|
|
8
|
+
import { findAddonsByNameOrId } from '../../models/ids-resolver.js';
|
|
9
|
+
import { sendToApi } from '../../models/send-to-api.js';
|
|
10
|
+
import { humanJsonOutputFormatOption, orgaIdOrNameOption } from '../global.options.js';
|
|
11
|
+
|
|
12
|
+
const URL_ENV_KEY = 'REDIS_URL';
|
|
13
|
+
|
|
14
|
+
const MAX_RETRIES_PER_REQUEST = 1;
|
|
15
|
+
|
|
16
|
+
async function getAddonUrl(ownerId, addonId) {
|
|
17
|
+
const envVars = await getAllEnvVars({ id: ownerId, addonId }).then(sendToApi);
|
|
18
|
+
const redisUrl = envVars.find((env) => env.name === URL_ENV_KEY)?.value;
|
|
19
|
+
|
|
20
|
+
if (!redisUrl) {
|
|
21
|
+
throw new Error(
|
|
22
|
+
`Environment variable ${styleText('red', URL_ENV_KEY)} not found, is it a Materia KV or Redis® add-on?`,
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return redisUrl;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
async function sendCommand(url, command) {
|
|
30
|
+
Logger.debug(`Sending command '${command.join(' ')}' to ${url}`);
|
|
31
|
+
const client = new Redis(url, { maxRetriesPerRequest: MAX_RETRIES_PER_REQUEST });
|
|
32
|
+
try {
|
|
33
|
+
const result = await client.call(...command);
|
|
34
|
+
Logger.debug(`Command result: ${result}`);
|
|
35
|
+
return result;
|
|
36
|
+
} finally {
|
|
37
|
+
await client.disconnect();
|
|
38
|
+
Logger.debug('Disconnected from server');
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export const kvCommand = defineCommand({
|
|
43
|
+
description: 'Send a raw command to a Materia KV or Redis® add-on',
|
|
44
|
+
since: '3.11.0',
|
|
45
|
+
isExperimental: true,
|
|
46
|
+
featureFlag: 'kv',
|
|
47
|
+
options: {
|
|
48
|
+
org: orgaIdOrNameOption,
|
|
49
|
+
format: humanJsonOutputFormatOption,
|
|
50
|
+
},
|
|
51
|
+
args: [
|
|
52
|
+
defineArgument({
|
|
53
|
+
schema: z.string(),
|
|
54
|
+
description: 'Add-on/Real ID (or name, if unambiguous) of a Materia KV or Redis® add-on',
|
|
55
|
+
placeholder: 'kv-id|addon-id|addon-name',
|
|
56
|
+
}),
|
|
57
|
+
defineArgument({
|
|
58
|
+
schema: z.string(),
|
|
59
|
+
description: 'The raw command to send to the Materia KV or Redis® add-on',
|
|
60
|
+
placeholder: 'command',
|
|
61
|
+
}),
|
|
62
|
+
],
|
|
63
|
+
async handler(options, addonIdOrRealIdOrName, ...restArgs) {
|
|
64
|
+
const { org, format } = options;
|
|
65
|
+
|
|
66
|
+
const addons = await findAddonsByNameOrId(addonIdOrRealIdOrName, org);
|
|
67
|
+
|
|
68
|
+
if (addons.length === 0) {
|
|
69
|
+
throw new Error(`Add-on ${addonIdOrRealIdOrName} not found`);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (addons.length > 1) {
|
|
73
|
+
const formattedAddons = addons
|
|
74
|
+
.map(({ addonId, ownerId }) => `\n${styleText('grey', `- ${addonId} (${ownerId})`)}`)
|
|
75
|
+
.join('');
|
|
76
|
+
throw new Error(`Several add-ons found for '${addonIdOrRealIdOrName}', use ID instead:${formattedAddons}`);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const { addonId, ownerId } = addons[0];
|
|
80
|
+
|
|
81
|
+
const url = await getAddonUrl(ownerId, addonId);
|
|
82
|
+
|
|
83
|
+
Logger.debug(`Extracted command: ${restArgs.join(' ')}`);
|
|
84
|
+
const command = restArgs;
|
|
85
|
+
|
|
86
|
+
const result = await sendCommand(url, command);
|
|
87
|
+
|
|
88
|
+
switch (format) {
|
|
89
|
+
case 'json': {
|
|
90
|
+
Logger.printJson(result);
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
case 'human':
|
|
94
|
+
default: {
|
|
95
|
+
Logger.println(result);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# 📖 `clever kv` command reference
|
|
2
|
+
|
|
3
|
+
> [!NOTE]
|
|
4
|
+
> 🧪 **Experimental**: This command may change or be removed in future versions.
|
|
5
|
+
> Enable with: `clever features enable kv`
|
|
6
|
+
|
|
7
|
+
## ➡️ `clever kv` <kbd>Since 3.11.0</kbd>
|
|
8
|
+
|
|
9
|
+
Send a raw command to a Materia KV or Redis® add-on
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
clever kv <kv-id|addon-id|addon-name> <command> [options]
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
### 📥 Arguments
|
|
16
|
+
|
|
17
|
+
|Name|Description|
|
|
18
|
+
|---|---|
|
|
19
|
+
|`kv-id|addon-id|addon-name`|Add-on/Real ID (or name, if unambiguous) of a Materia KV or Redis® add-on|
|
|
20
|
+
|`command`|The raw command to send to the Materia KV or Redis® add-on|
|
|
21
|
+
|
|
22
|
+
### ⚙️ Options
|
|
23
|
+
|
|
24
|
+
|Name|Description|
|
|
25
|
+
|---|---|
|
|
26
|
+
|`-F`, `--format` `<format>`|Output format (human, json) (default: human)|
|
|
27
|
+
|`-o`, `--org`, `--owner` `<org-id\|org-name>`|Organisation to target by its ID (or name, if unambiguous)|
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { defineCommand } from '../../lib/define-command.js';
|
|
2
|
+
import { styleText } from '../../lib/style-text.js';
|
|
3
|
+
import { Logger } from '../../logger.js';
|
|
4
|
+
import * as Application from '../../models/application.js';
|
|
5
|
+
import { appIdOrNameArg } from '../global.args.js';
|
|
6
|
+
import { aliasCreationOption, orgaIdOrNameOption } from '../global.options.js';
|
|
7
|
+
|
|
8
|
+
export const linkCommand = defineCommand({
|
|
9
|
+
description: 'Link this repo to an existing application',
|
|
10
|
+
since: '0.2.0',
|
|
11
|
+
options: {
|
|
12
|
+
alias: aliasCreationOption,
|
|
13
|
+
org: orgaIdOrNameOption,
|
|
14
|
+
},
|
|
15
|
+
args: [appIdOrNameArg],
|
|
16
|
+
async handler(options, app) {
|
|
17
|
+
const { org: orgaIdOrName, alias } = options;
|
|
18
|
+
|
|
19
|
+
let appConfigEntry;
|
|
20
|
+
if (app.app_id != null && orgaIdOrName != null) {
|
|
21
|
+
Logger.warn("You've specified a unique application ID, organisation option will be ignored");
|
|
22
|
+
appConfigEntry = await Application.linkRepo(app, null, alias);
|
|
23
|
+
} else {
|
|
24
|
+
appConfigEntry = await Application.linkRepo(app, orgaIdOrName, alias);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
Logger.printSuccess(
|
|
28
|
+
`Application ${styleText('green', appConfigEntry.app_id)} has been successfully linked to local alias ${styleText('green', appConfigEntry.alias)}!`,
|
|
29
|
+
);
|
|
30
|
+
},
|
|
31
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# 📖 `clever link` command reference
|
|
2
|
+
|
|
3
|
+
## ➡️ `clever link` <kbd>Since 0.2.0</kbd>
|
|
4
|
+
|
|
5
|
+
Link this repo to an existing application
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
clever link <app-id|app-name> [options]
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
### 📥 Arguments
|
|
12
|
+
|
|
13
|
+
|Name|Description|
|
|
14
|
+
|---|---|
|
|
15
|
+
|`app-id|app-name`|Application ID (or name, if unambiguous)|
|
|
16
|
+
|
|
17
|
+
### ⚙️ Options
|
|
18
|
+
|
|
19
|
+
|Name|Description|
|
|
20
|
+
|---|---|
|
|
21
|
+
|`-a`, `--alias` `<alias>`|Short name for the application|
|
|
22
|
+
|`-o`, `--org`, `--owner` `<org-id\|org-name>`|Organisation to target by its ID (or name, if unambiguous)|
|
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
import crypto from 'node:crypto';
|
|
2
2
|
import { setTimeout as delay } from 'node:timers/promises';
|
|
3
3
|
import open from 'open';
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
import pkg from '../../../package.json' with { type: 'json' };
|
|
6
|
+
import { defineCommand } from '../../lib/define-command.js';
|
|
7
|
+
import { defineOption } from '../../lib/define-option.js';
|
|
8
|
+
import { styleText } from '../../lib/style-text.js';
|
|
9
|
+
import { Logger } from '../../logger.js';
|
|
10
|
+
import { conf, writeOAuthConf } from '../../models/configuration.js';
|
|
11
|
+
import * as User from '../../models/user.js';
|
|
9
12
|
|
|
10
|
-
// 20 random bytes as Base64URL
|
|
11
13
|
function randomToken() {
|
|
12
14
|
return crypto.randomBytes(20).toString('base64').replace(/\//g, '-').replace(/\+/g, '_').replace(/=/g, '');
|
|
13
15
|
}
|
|
14
16
|
|
|
15
17
|
const POLLING_INTERVAL = 2000;
|
|
18
|
+
|
|
16
19
|
const POLLING_MAX_TRY_COUNT = 60;
|
|
17
20
|
|
|
18
21
|
function pollOauthData(url, tryCount = 0) {
|
|
@@ -55,22 +58,41 @@ async function loginViaConsole() {
|
|
|
55
58
|
return pollOauthData(cliPollUrl.toString());
|
|
56
59
|
}
|
|
57
60
|
|
|
58
|
-
export
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
61
|
+
export const loginCommand = defineCommand({
|
|
62
|
+
description: 'Login to Clever Cloud',
|
|
63
|
+
since: '0.2.0',
|
|
64
|
+
options: {
|
|
65
|
+
token: defineOption({
|
|
66
|
+
name: 'token',
|
|
67
|
+
schema: z.string().optional(),
|
|
68
|
+
description: 'Directly give an existing token',
|
|
69
|
+
placeholder: 'token',
|
|
70
|
+
}),
|
|
71
|
+
secret: defineOption({
|
|
72
|
+
name: 'secret',
|
|
73
|
+
schema: z.string().optional(),
|
|
74
|
+
description: 'Directly give an existing secret',
|
|
75
|
+
placeholder: 'secret',
|
|
76
|
+
}),
|
|
77
|
+
},
|
|
78
|
+
args: [],
|
|
79
|
+
async handler(options) {
|
|
80
|
+
const { token, secret } = options;
|
|
81
|
+
const isLoginWithArgs = token != null && secret != null;
|
|
82
|
+
const isInteractiveLogin = token == null && secret == null;
|
|
62
83
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
84
|
+
if (isLoginWithArgs) {
|
|
85
|
+
return writeOAuthConf({ token, secret });
|
|
86
|
+
}
|
|
66
87
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
88
|
+
if (isInteractiveLogin) {
|
|
89
|
+
const oauthData = await loginViaConsole();
|
|
90
|
+
await writeOAuthConf(oauthData);
|
|
91
|
+
const { name, email } = await User.getCurrent();
|
|
92
|
+
const formattedName = name || styleText(['red', 'bold'], '[unspecified name]');
|
|
93
|
+
return Logger.println(`Login successful as ${formattedName} <${email}>`);
|
|
94
|
+
}
|
|
74
95
|
|
|
75
|
-
|
|
76
|
-
}
|
|
96
|
+
throw new Error('Both `--token` and `--secret` have to be defined');
|
|
97
|
+
},
|
|
98
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# 📖 `clever login` command reference
|
|
2
|
+
|
|
3
|
+
## ➡️ `clever login` <kbd>Since 0.2.0</kbd>
|
|
4
|
+
|
|
5
|
+
Login to Clever Cloud
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
clever login [options]
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
### ⚙️ Options
|
|
12
|
+
|
|
13
|
+
|Name|Description|
|
|
14
|
+
|---|---|
|
|
15
|
+
|`--secret` `<secret>`|Directly give an existing secret|
|
|
16
|
+
|`--token` `<token>`|Directly give an existing token|
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { defineCommand } from '../../lib/define-command.js';
|
|
2
|
+
import { Logger } from '../../logger.js';
|
|
3
|
+
import { conf, writeOAuthConf } from '../../models/configuration.js';
|
|
4
|
+
|
|
5
|
+
export const logoutCommand = defineCommand({
|
|
6
|
+
description: 'Logout from Clever Cloud',
|
|
7
|
+
since: '1.0.0',
|
|
8
|
+
options: {},
|
|
9
|
+
args: [],
|
|
10
|
+
async handler() {
|
|
11
|
+
// write empty object
|
|
12
|
+
await writeOAuthConf({});
|
|
13
|
+
Logger.println(`${conf.CONFIGURATION_FILE} has been updated.`);
|
|
14
|
+
},
|
|
15
|
+
});
|