@nocobase/cli 2.1.0-alpha.4 → 2.1.0-alpha.40
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/LICENSE.txt +107 -0
- package/README.md +393 -19
- package/README.zh-CN.md +343 -0
- package/bin/run.cmd +3 -0
- package/bin/run.js +135 -0
- package/bin/session-env.js +39 -0
- package/dist/commands/api/resource/create.js +15 -0
- package/dist/commands/api/resource/destroy.js +15 -0
- package/dist/commands/api/resource/get.js +15 -0
- package/dist/commands/api/resource/index.js +20 -0
- package/dist/commands/api/resource/list.js +16 -0
- package/dist/commands/api/resource/query.js +15 -0
- package/dist/commands/api/resource/update.js +15 -0
- package/dist/commands/app/down.js +301 -0
- package/dist/commands/app/logs.js +114 -0
- package/dist/commands/app/restart.js +158 -0
- package/dist/commands/app/start.js +305 -0
- package/dist/commands/app/stop.js +115 -0
- package/dist/commands/app/upgrade.js +636 -0
- package/dist/commands/backup/create.js +147 -0
- package/dist/commands/backup/index.js +20 -0
- package/dist/commands/backup/restore.js +105 -0
- package/{src/cli.js → dist/commands/build.js} +4 -11
- package/dist/commands/config/delete.js +30 -0
- package/dist/commands/config/get.js +29 -0
- package/dist/commands/config/index.js +20 -0
- package/dist/commands/config/list.js +29 -0
- package/dist/commands/config/set.js +35 -0
- package/dist/commands/db/check.js +240 -0
- package/dist/commands/db/logs.js +85 -0
- package/dist/commands/db/ps.js +60 -0
- package/dist/commands/db/shared.js +96 -0
- package/dist/commands/db/start.js +71 -0
- package/dist/commands/db/stop.js +71 -0
- package/{templates/plugin/src/client/models/index.ts → dist/commands/dev.js} +4 -4
- package/{src/commands/locale/react-js-cron/index.js → dist/commands/down.js} +3 -8
- package/dist/commands/download.js +13 -0
- package/dist/commands/env/add.js +366 -0
- package/dist/commands/env/auth.js +130 -0
- package/dist/commands/env/current.js +21 -0
- package/dist/commands/env/info.js +157 -0
- package/dist/commands/env/list.js +44 -0
- package/dist/commands/env/remove.js +84 -0
- package/dist/commands/env/shared.js +158 -0
- package/dist/commands/env/status.js +90 -0
- package/dist/commands/env/update.js +74 -0
- package/dist/commands/env/use.js +38 -0
- package/dist/commands/examples/prompts-stages.js +150 -0
- package/dist/commands/examples/prompts-test.js +181 -0
- package/dist/commands/init.js +1092 -0
- package/dist/commands/install.js +2378 -0
- package/dist/commands/license/activate.js +360 -0
- package/dist/commands/license/env.js +94 -0
- package/dist/commands/license/generate-id.js +108 -0
- package/dist/commands/license/id.js +70 -0
- package/dist/commands/license/index.js +20 -0
- package/dist/commands/license/plugins/clean.js +115 -0
- package/dist/commands/license/plugins/index.js +20 -0
- package/dist/commands/license/plugins/list.js +64 -0
- package/dist/commands/license/plugins/shared.js +325 -0
- package/dist/commands/license/plugins/sync.js +285 -0
- package/dist/commands/license/shared.js +423 -0
- package/dist/commands/license/status.js +64 -0
- package/dist/commands/logs.js +12 -0
- package/dist/commands/plugin/disable.js +86 -0
- package/dist/commands/plugin/enable.js +86 -0
- package/dist/commands/plugin/list.js +82 -0
- package/dist/commands/pm/disable.js +12 -0
- package/dist/commands/pm/enable.js +12 -0
- package/dist/commands/pm/list.js +12 -0
- package/dist/commands/restart.js +12 -0
- package/dist/commands/scaffold/migration.js +38 -0
- package/dist/commands/scaffold/plugin.js +37 -0
- package/dist/commands/self/check.js +71 -0
- package/dist/commands/self/index.js +20 -0
- package/dist/commands/self/update.js +95 -0
- package/dist/commands/session/id.js +24 -0
- package/dist/commands/session/remove.js +57 -0
- package/dist/commands/session/setup.js +62 -0
- package/dist/commands/skills/check.js +69 -0
- package/dist/commands/skills/index.js +20 -0
- package/dist/commands/skills/install.js +80 -0
- package/dist/commands/skills/remove.js +80 -0
- package/dist/commands/skills/update.js +87 -0
- package/dist/commands/source/build.js +58 -0
- package/dist/commands/source/dev.js +182 -0
- package/dist/commands/source/download.js +880 -0
- package/dist/commands/source/publish.js +109 -0
- package/dist/commands/source/registry/logs.js +70 -0
- package/dist/commands/source/registry/start.js +57 -0
- package/dist/commands/source/registry/status.js +33 -0
- package/dist/commands/source/registry/stop.js +48 -0
- package/dist/commands/source/test.js +477 -0
- package/dist/commands/start.js +12 -0
- package/dist/commands/stop.js +12 -0
- package/dist/commands/test.js +12 -0
- package/dist/commands/upgrade.js +12 -0
- package/dist/commands/v1.js +210 -0
- package/dist/generated/command-registry.js +133 -0
- package/dist/help/runtime-help.js +23 -0
- package/dist/lib/api-client.js +329 -0
- package/dist/lib/app-health.js +126 -0
- package/dist/lib/app-managed-resources.js +316 -0
- package/dist/lib/app-runtime.js +180 -0
- package/dist/lib/auth-store.js +368 -0
- package/dist/lib/backup.js +171 -0
- package/dist/lib/bootstrap.js +403 -0
- package/dist/lib/build-config.js +18 -0
- package/dist/lib/builtin-db.js +86 -0
- package/dist/lib/cli-config.js +176 -0
- package/dist/lib/cli-home.js +47 -0
- package/dist/lib/cli-locale.js +129 -0
- package/dist/lib/command-discovery.js +39 -0
- package/dist/lib/db-connection-check.js +158 -0
- package/dist/lib/docker-env-file.js +52 -0
- package/dist/lib/docker-image.js +37 -0
- package/dist/lib/env-auth.js +873 -0
- package/dist/lib/env-config.js +94 -0
- package/dist/lib/env-guard.js +62 -0
- package/dist/lib/generated-command.js +186 -0
- package/dist/lib/http-request.js +49 -0
- package/dist/lib/inquirer-theme.js +17 -0
- package/dist/lib/inquirer.js +244 -0
- package/dist/lib/naming.js +70 -0
- package/dist/lib/object-utils.js +76 -0
- package/dist/lib/openapi.js +62 -0
- package/dist/lib/plugin-storage.js +64 -0
- package/dist/lib/post-processors.js +23 -0
- package/dist/lib/prompt-catalog-core.js +185 -0
- package/dist/lib/prompt-catalog-terminal.js +375 -0
- package/{src/index.js → dist/lib/prompt-catalog.js} +2 -6
- package/dist/lib/prompt-validators.js +240 -0
- package/dist/lib/prompt-web-ui.js +2103 -0
- package/dist/lib/resource-command.js +357 -0
- package/dist/lib/resource-request.js +104 -0
- package/dist/lib/run-npm.js +275 -0
- package/dist/lib/runtime-env-vars.js +32 -0
- package/dist/lib/runtime-generator.js +498 -0
- package/dist/lib/runtime-store.js +56 -0
- package/dist/lib/self-manager.js +301 -0
- package/dist/lib/session-id.js +17 -0
- package/dist/lib/session-integration.js +703 -0
- package/dist/lib/session-store.js +118 -0
- package/dist/lib/skills-manager.js +360 -0
- package/dist/lib/source-publish.js +306 -0
- package/dist/lib/source-registry.js +188 -0
- package/dist/lib/startup-update.js +285 -0
- package/dist/lib/ui.js +155 -0
- package/dist/locale/en-US.json +344 -0
- package/dist/locale/zh-CN.json +344 -0
- package/dist/post-processors/data-modeling.js +84 -0
- package/dist/post-processors/data-source-manager.js +138 -0
- package/dist/post-processors/index.js +19 -0
- package/nocobase-ctl.config.json +388 -0
- package/package.json +100 -26
- package/LICENSE +0 -661
- package/bin/index.js +0 -39
- package/nocobase.conf.tpl +0 -95
- package/src/commands/benchmark.js +0 -73
- package/src/commands/build.js +0 -49
- package/src/commands/clean.js +0 -30
- package/src/commands/client.js +0 -166
- package/src/commands/create-nginx-conf.js +0 -37
- package/src/commands/create-plugin.js +0 -33
- package/src/commands/dev.js +0 -200
- package/src/commands/doc.js +0 -76
- package/src/commands/e2e.js +0 -265
- package/src/commands/global.js +0 -43
- package/src/commands/index.js +0 -45
- package/src/commands/instance-id.js +0 -47
- package/src/commands/locale/cronstrue.js +0 -122
- package/src/commands/locale/react-js-cron/en-US.json +0 -75
- package/src/commands/locale/react-js-cron/zh-CN.json +0 -33
- package/src/commands/locale/react-js-cron/zh-TW.json +0 -33
- package/src/commands/locale.js +0 -81
- package/src/commands/p-test.js +0 -88
- package/src/commands/perf.js +0 -63
- package/src/commands/pkg.js +0 -321
- package/src/commands/pm2.js +0 -37
- package/src/commands/postinstall.js +0 -88
- package/src/commands/start.js +0 -148
- package/src/commands/tar.js +0 -36
- package/src/commands/test-coverage.js +0 -55
- package/src/commands/test.js +0 -107
- package/src/commands/umi.js +0 -33
- package/src/commands/update-deps.js +0 -72
- package/src/commands/upgrade.js +0 -47
- package/src/commands/view-license-key.js +0 -44
- package/src/license.js +0 -76
- package/src/logger.js +0 -75
- package/src/plugin-generator.js +0 -80
- package/src/util.js +0 -517
- package/templates/bundle-status.html +0 -338
- package/templates/create-app-package.json +0 -39
- package/templates/plugin/.npmignore.tpl +0 -2
- package/templates/plugin/README.md.tpl +0 -1
- package/templates/plugin/client.d.ts +0 -2
- package/templates/plugin/client.js +0 -1
- package/templates/plugin/package.json.tpl +0 -11
- package/templates/plugin/server.d.ts +0 -2
- package/templates/plugin/server.js +0 -1
- package/templates/plugin/src/client/client.d.ts +0 -249
- package/templates/plugin/src/client/index.tsx.tpl +0 -1
- package/templates/plugin/src/client/locale.ts +0 -21
- package/templates/plugin/src/client/plugin.tsx.tpl +0 -10
- package/templates/plugin/src/index.ts +0 -2
- package/templates/plugin/src/locale/en-US.json +0 -1
- package/templates/plugin/src/locale/zh-CN.json +0 -1
- package/templates/plugin/src/server/collections/.gitkeep +0 -0
- package/templates/plugin/src/server/index.ts.tpl +0 -1
- package/templates/plugin/src/server/plugin.ts.tpl +0 -19
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import { Args, Command, Flags } from '@oclif/core';
|
|
10
|
+
import { setCurrentEnv, upsertEnv } from '../../lib/auth-store.js';
|
|
11
|
+
import { resolveDefaultConfigScope } from '../../lib/cli-home.js';
|
|
12
|
+
import { buildStoredEnvConfig, } from '../../lib/env-config.js';
|
|
13
|
+
import { runPromptCatalog, } from '../../lib/prompt-catalog.js';
|
|
14
|
+
import { applyCliLocale, CLI_LOCALE_FLAG_DESCRIPTION, CLI_LOCALE_FLAG_OPTIONS, localeText, } from '../../lib/cli-locale.js';
|
|
15
|
+
import { validateApiBaseUrl } from '../../lib/prompt-validators.js';
|
|
16
|
+
import { printInfo, printStage, printSuccess, printVerbose, setVerboseMode } from '../../lib/ui.js';
|
|
17
|
+
const ENV_RUNTIME_FLAG_MAP = {
|
|
18
|
+
source: 'source',
|
|
19
|
+
'download-version': 'downloadVersion',
|
|
20
|
+
'docker-registry': 'dockerRegistry',
|
|
21
|
+
'docker-platform': 'dockerPlatform',
|
|
22
|
+
'git-url': 'gitUrl',
|
|
23
|
+
'npm-registry': 'npmRegistry',
|
|
24
|
+
'app-root-path': 'appRootPath',
|
|
25
|
+
'storage-path': 'storagePath',
|
|
26
|
+
'app-port': 'appPort',
|
|
27
|
+
'app-key': 'appKey',
|
|
28
|
+
timezone: 'timezone',
|
|
29
|
+
'db-dialect': 'dbDialect',
|
|
30
|
+
'builtin-db-image': 'builtinDbImage',
|
|
31
|
+
'db-host': 'dbHost',
|
|
32
|
+
'db-port': 'dbPort',
|
|
33
|
+
'db-database': 'dbDatabase',
|
|
34
|
+
'db-user': 'dbUser',
|
|
35
|
+
'db-password': 'dbPassword',
|
|
36
|
+
'db-schema': 'dbSchema',
|
|
37
|
+
'db-table-prefix': 'dbTablePrefix',
|
|
38
|
+
'root-username': 'rootUsername',
|
|
39
|
+
'root-email': 'rootEmail',
|
|
40
|
+
'root-password': 'rootPassword',
|
|
41
|
+
'root-nickname': 'rootNickname',
|
|
42
|
+
};
|
|
43
|
+
const ENV_BOOLEAN_RUNTIME_FLAG_MAP = {
|
|
44
|
+
'builtin-db': 'builtinDb',
|
|
45
|
+
'dev-dependencies': 'devDependencies',
|
|
46
|
+
build: 'build',
|
|
47
|
+
'build-dts': 'buildDts',
|
|
48
|
+
'db-underscored': 'dbUnderscored',
|
|
49
|
+
};
|
|
50
|
+
const envAddText = (key, values) => localeText(`commands.envAdd.${key}`, values);
|
|
51
|
+
const envAddAccessTokenPrompt = {
|
|
52
|
+
type: 'text',
|
|
53
|
+
message: envAddText('prompts.accessToken.message'),
|
|
54
|
+
required: true,
|
|
55
|
+
hidden: (values) => values.authType !== 'token' || values.skipAuth === true,
|
|
56
|
+
};
|
|
57
|
+
function formatDeferredAuthMessage(envName, authType) {
|
|
58
|
+
const normalizedAuthType = String(authType ?? '').trim();
|
|
59
|
+
const nextStep = `Authentication was skipped for env "${envName}". Run \`nb env auth ${envName}\` to finish setup.`;
|
|
60
|
+
if (normalizedAuthType === 'token') {
|
|
61
|
+
return `${nextStep} You will be prompted for an access token.`;
|
|
62
|
+
}
|
|
63
|
+
if (normalizedAuthType === 'oauth') {
|
|
64
|
+
return `${nextStep} A browser sign-in flow will be started.`;
|
|
65
|
+
}
|
|
66
|
+
return nextStep;
|
|
67
|
+
}
|
|
68
|
+
export default class EnvAdd extends Command {
|
|
69
|
+
static summary = 'Save a named NocoBase API endpoint (token or OAuth), then switch the CLI to use it';
|
|
70
|
+
static examples = [
|
|
71
|
+
'<%= config.bin %> <%= command.id %>',
|
|
72
|
+
'<%= config.bin %> <%= command.id %> local',
|
|
73
|
+
'<%= config.bin %> <%= command.id %> local --api-base-url http://localhost:13000/api --auth-type oauth',
|
|
74
|
+
];
|
|
75
|
+
static args = {
|
|
76
|
+
name: Args.string({
|
|
77
|
+
description: 'Environment name to save (optional first argument; in a TTY, prompted when omitted; required when not using a TTY)',
|
|
78
|
+
required: false,
|
|
79
|
+
}),
|
|
80
|
+
};
|
|
81
|
+
static flags = {
|
|
82
|
+
env: Flags.string({
|
|
83
|
+
char: 'e',
|
|
84
|
+
hidden: true,
|
|
85
|
+
deprecated: true,
|
|
86
|
+
description: 'Environment name (same as the optional positional argument; for compatibility with -e/--env on other commands)',
|
|
87
|
+
}),
|
|
88
|
+
verbose: Flags.boolean({
|
|
89
|
+
description: 'Print detailed progress while writing config',
|
|
90
|
+
default: false,
|
|
91
|
+
}),
|
|
92
|
+
locale: Flags.string({
|
|
93
|
+
description: CLI_LOCALE_FLAG_DESCRIPTION,
|
|
94
|
+
options: CLI_LOCALE_FLAG_OPTIONS,
|
|
95
|
+
}),
|
|
96
|
+
'no-intro': Flags.boolean({
|
|
97
|
+
hidden: true,
|
|
98
|
+
description: 'Skip command intro when invoked by another CLI command',
|
|
99
|
+
default: false,
|
|
100
|
+
}),
|
|
101
|
+
'default-api-base-url': Flags.string({
|
|
102
|
+
char: 'd',
|
|
103
|
+
hidden: true,
|
|
104
|
+
description: 'Default API base URL for HTTP API calls, including the /api prefix (e.g. http://localhost:13000/api); prompted in a TTY when omitted',
|
|
105
|
+
}),
|
|
106
|
+
'api-base-url': Flags.string({
|
|
107
|
+
char: 'u',
|
|
108
|
+
description: 'Root URL for HTTP API calls, including the /api prefix (e.g. http://localhost:13000/api); prompted in a TTY when omitted',
|
|
109
|
+
}),
|
|
110
|
+
'auth-type': Flags.string({
|
|
111
|
+
char: 'a',
|
|
112
|
+
description: 'Authentication: token (API key) or oauth (browser login via `nb env auth`); prompted in a TTY when omitted',
|
|
113
|
+
options: ['token', 'oauth'],
|
|
114
|
+
}),
|
|
115
|
+
'access-token': Flags.string({
|
|
116
|
+
char: 't',
|
|
117
|
+
aliases: ['token'],
|
|
118
|
+
description: 'API key or access token when using --auth-type token (prompted in a TTY when omitted)',
|
|
119
|
+
}),
|
|
120
|
+
'skip-auth': Flags.boolean({
|
|
121
|
+
description: 'Save the env now and finish authentication later with `nb env auth`',
|
|
122
|
+
default: false,
|
|
123
|
+
}),
|
|
124
|
+
source: Flags.string({
|
|
125
|
+
hidden: true,
|
|
126
|
+
description: 'Application source saved with this env',
|
|
127
|
+
}),
|
|
128
|
+
'download-version': Flags.string({
|
|
129
|
+
hidden: true,
|
|
130
|
+
description: 'Downloaded app version saved with this env',
|
|
131
|
+
}),
|
|
132
|
+
'docker-registry': Flags.string({
|
|
133
|
+
hidden: true,
|
|
134
|
+
description: 'Docker registry saved with this env',
|
|
135
|
+
}),
|
|
136
|
+
'docker-platform': Flags.string({
|
|
137
|
+
hidden: true,
|
|
138
|
+
description: 'Docker image platform saved with this env',
|
|
139
|
+
}),
|
|
140
|
+
'git-url': Flags.string({
|
|
141
|
+
hidden: true,
|
|
142
|
+
description: 'Git repository URL saved with this env',
|
|
143
|
+
}),
|
|
144
|
+
'npm-registry': Flags.string({
|
|
145
|
+
hidden: true,
|
|
146
|
+
description: 'npm registry saved with this env',
|
|
147
|
+
}),
|
|
148
|
+
'dev-dependencies': Flags.boolean({
|
|
149
|
+
allowNo: true,
|
|
150
|
+
hidden: true,
|
|
151
|
+
description: 'Whether development dependencies were installed for this env',
|
|
152
|
+
}),
|
|
153
|
+
build: Flags.boolean({
|
|
154
|
+
allowNo: true,
|
|
155
|
+
hidden: true,
|
|
156
|
+
description: 'Whether the app was built after download for this env',
|
|
157
|
+
}),
|
|
158
|
+
'build-dts': Flags.boolean({
|
|
159
|
+
allowNo: true,
|
|
160
|
+
hidden: true,
|
|
161
|
+
description: 'Whether declaration files were emitted during build for this env',
|
|
162
|
+
}),
|
|
163
|
+
'app-root-path': Flags.string({
|
|
164
|
+
hidden: true,
|
|
165
|
+
description: 'Application root path saved with this env',
|
|
166
|
+
}),
|
|
167
|
+
'storage-path': Flags.string({
|
|
168
|
+
hidden: true,
|
|
169
|
+
description: 'Storage path saved with this env',
|
|
170
|
+
}),
|
|
171
|
+
'app-port': Flags.string({
|
|
172
|
+
hidden: true,
|
|
173
|
+
description: 'Application HTTP port saved with this env',
|
|
174
|
+
}),
|
|
175
|
+
'app-key': Flags.string({
|
|
176
|
+
hidden: true,
|
|
177
|
+
description: 'Application secret key saved with this env',
|
|
178
|
+
}),
|
|
179
|
+
timezone: Flags.string({
|
|
180
|
+
hidden: true,
|
|
181
|
+
description: 'Application timezone saved with this env',
|
|
182
|
+
}),
|
|
183
|
+
'builtin-db': Flags.boolean({
|
|
184
|
+
allowNo: true,
|
|
185
|
+
hidden: true,
|
|
186
|
+
description: 'Whether this env uses a CLI-managed built-in database',
|
|
187
|
+
}),
|
|
188
|
+
'db-dialect': Flags.string({
|
|
189
|
+
hidden: true,
|
|
190
|
+
description: 'Database dialect saved with this env',
|
|
191
|
+
}),
|
|
192
|
+
'builtin-db-image': Flags.string({
|
|
193
|
+
hidden: true,
|
|
194
|
+
description: 'Built-in database image saved with this env',
|
|
195
|
+
}),
|
|
196
|
+
'db-host': Flags.string({
|
|
197
|
+
hidden: true,
|
|
198
|
+
description: 'Database host saved with this env',
|
|
199
|
+
}),
|
|
200
|
+
'db-port': Flags.string({
|
|
201
|
+
hidden: true,
|
|
202
|
+
description: 'Database port saved with this env',
|
|
203
|
+
}),
|
|
204
|
+
'db-database': Flags.string({
|
|
205
|
+
hidden: true,
|
|
206
|
+
description: 'Database name saved with this env',
|
|
207
|
+
}),
|
|
208
|
+
'db-user': Flags.string({
|
|
209
|
+
hidden: true,
|
|
210
|
+
description: 'Database user saved with this env',
|
|
211
|
+
}),
|
|
212
|
+
'db-password': Flags.string({
|
|
213
|
+
hidden: true,
|
|
214
|
+
description: 'Database password saved with this env',
|
|
215
|
+
}),
|
|
216
|
+
'db-schema': Flags.string({
|
|
217
|
+
hidden: true,
|
|
218
|
+
description: 'Database schema saved with this env',
|
|
219
|
+
}),
|
|
220
|
+
'db-table-prefix': Flags.string({
|
|
221
|
+
hidden: true,
|
|
222
|
+
description: 'Database table prefix saved with this env',
|
|
223
|
+
}),
|
|
224
|
+
'db-underscored': Flags.boolean({
|
|
225
|
+
allowNo: true,
|
|
226
|
+
hidden: true,
|
|
227
|
+
description: 'Whether this env uses underscored database naming',
|
|
228
|
+
}),
|
|
229
|
+
'root-username': Flags.string({
|
|
230
|
+
hidden: true,
|
|
231
|
+
description: 'Initial root username saved with this env',
|
|
232
|
+
}),
|
|
233
|
+
'root-email': Flags.string({
|
|
234
|
+
hidden: true,
|
|
235
|
+
description: 'Initial root email saved with this env',
|
|
236
|
+
}),
|
|
237
|
+
'root-password': Flags.string({
|
|
238
|
+
hidden: true,
|
|
239
|
+
description: 'Initial root password saved with this env',
|
|
240
|
+
}),
|
|
241
|
+
'root-nickname': Flags.string({
|
|
242
|
+
hidden: true,
|
|
243
|
+
description: 'Initial root nickname saved with this env',
|
|
244
|
+
}),
|
|
245
|
+
};
|
|
246
|
+
static prompts = {
|
|
247
|
+
name: {
|
|
248
|
+
type: 'text',
|
|
249
|
+
message: envAddText('prompts.name.message'),
|
|
250
|
+
placeholder: envAddText('prompts.name.placeholder'),
|
|
251
|
+
required: true,
|
|
252
|
+
},
|
|
253
|
+
apiBaseUrl: {
|
|
254
|
+
type: 'text',
|
|
255
|
+
message: envAddText('prompts.apiBaseUrl.message'),
|
|
256
|
+
placeholder: envAddText('prompts.apiBaseUrl.placeholder'),
|
|
257
|
+
required: true,
|
|
258
|
+
validate: validateApiBaseUrl,
|
|
259
|
+
},
|
|
260
|
+
authType: {
|
|
261
|
+
type: 'select',
|
|
262
|
+
message: envAddText('prompts.authType.message'),
|
|
263
|
+
options: [
|
|
264
|
+
{
|
|
265
|
+
value: 'oauth',
|
|
266
|
+
label: envAddText('prompts.authType.oauthLabel'),
|
|
267
|
+
hint: envAddText('prompts.authType.oauthHint'),
|
|
268
|
+
},
|
|
269
|
+
{ value: 'token', label: envAddText('prompts.authType.tokenLabel') },
|
|
270
|
+
],
|
|
271
|
+
initialValue: 'oauth',
|
|
272
|
+
required: true,
|
|
273
|
+
},
|
|
274
|
+
accessToken: envAddAccessTokenPrompt,
|
|
275
|
+
};
|
|
276
|
+
buildPromptValues(nameArg, flags) {
|
|
277
|
+
const values = {};
|
|
278
|
+
const name = nameArg?.trim() || flags.env?.trim();
|
|
279
|
+
if (name) {
|
|
280
|
+
values.name = name;
|
|
281
|
+
}
|
|
282
|
+
const apiFromFlag = flags['api-base-url'];
|
|
283
|
+
if (typeof apiFromFlag === 'string' && apiFromFlag.trim() !== '') {
|
|
284
|
+
values.apiBaseUrl = apiFromFlag.trim();
|
|
285
|
+
}
|
|
286
|
+
if (flags['auth-type']) {
|
|
287
|
+
values.authType = flags['auth-type'];
|
|
288
|
+
}
|
|
289
|
+
if (flags['skip-auth']) {
|
|
290
|
+
values.skipAuth = true;
|
|
291
|
+
}
|
|
292
|
+
const token = flags['access-token'] ?? flags.token;
|
|
293
|
+
if (typeof token === 'string' && token !== '') {
|
|
294
|
+
values.accessToken = token;
|
|
295
|
+
}
|
|
296
|
+
return values;
|
|
297
|
+
}
|
|
298
|
+
buildPromptInitialValues(flags) {
|
|
299
|
+
const initialValues = {};
|
|
300
|
+
const defaultApiBaseUrl = flags['default-api-base-url']?.trim();
|
|
301
|
+
if (defaultApiBaseUrl) {
|
|
302
|
+
initialValues.apiBaseUrl = defaultApiBaseUrl;
|
|
303
|
+
}
|
|
304
|
+
return initialValues;
|
|
305
|
+
}
|
|
306
|
+
buildPromptCatalog(flags) {
|
|
307
|
+
if (!flags['skip-auth']) {
|
|
308
|
+
return EnvAdd.prompts;
|
|
309
|
+
}
|
|
310
|
+
return {
|
|
311
|
+
...EnvAdd.prompts,
|
|
312
|
+
accessToken: {
|
|
313
|
+
...envAddAccessTokenPrompt,
|
|
314
|
+
hidden: () => true,
|
|
315
|
+
},
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
buildEnvConfig(results, flags) {
|
|
319
|
+
const envConfigInput = {
|
|
320
|
+
apiBaseUrl: results.apiBaseUrl,
|
|
321
|
+
authType: results.authType,
|
|
322
|
+
accessToken: results.accessToken,
|
|
323
|
+
};
|
|
324
|
+
for (const [flagName, configKey] of Object.entries(ENV_RUNTIME_FLAG_MAP)) {
|
|
325
|
+
const value = flags[flagName];
|
|
326
|
+
envConfigInput[configKey] = value;
|
|
327
|
+
}
|
|
328
|
+
for (const [flagName, configKey] of Object.entries(ENV_BOOLEAN_RUNTIME_FLAG_MAP)) {
|
|
329
|
+
const value = flags[flagName];
|
|
330
|
+
envConfigInput[configKey] = value;
|
|
331
|
+
}
|
|
332
|
+
return buildStoredEnvConfig(envConfigInput);
|
|
333
|
+
}
|
|
334
|
+
async run() {
|
|
335
|
+
const { args, flags } = await this.parse(EnvAdd);
|
|
336
|
+
const parsedFlags = flags;
|
|
337
|
+
if (parsedFlags['skip-auth'] && (parsedFlags['access-token'] !== undefined || parsedFlags.token !== undefined)) {
|
|
338
|
+
this.error('--skip-auth cannot be used with --access-token or --token.');
|
|
339
|
+
}
|
|
340
|
+
applyCliLocale(parsedFlags.locale);
|
|
341
|
+
setVerboseMode(parsedFlags.verbose);
|
|
342
|
+
if (!parsedFlags['no-intro']) {
|
|
343
|
+
printStage('Connect to NocoBase');
|
|
344
|
+
}
|
|
345
|
+
const results = await runPromptCatalog(this.buildPromptCatalog(parsedFlags), {
|
|
346
|
+
values: this.buildPromptValues(args.name, parsedFlags),
|
|
347
|
+
initialValues: this.buildPromptInitialValues(parsedFlags),
|
|
348
|
+
command: this,
|
|
349
|
+
});
|
|
350
|
+
const envName = String(results.name);
|
|
351
|
+
const envConfig = this.buildEnvConfig(results, parsedFlags);
|
|
352
|
+
printVerbose(`Saving env "${envName}" globally.`);
|
|
353
|
+
await upsertEnv(envName, envConfig, { scope: resolveDefaultConfigScope() });
|
|
354
|
+
await setCurrentEnv(envName, { scope: resolveDefaultConfigScope() });
|
|
355
|
+
if (parsedFlags['skip-auth']) {
|
|
356
|
+
printSuccess(`✔ Env "${envName}" was saved.`);
|
|
357
|
+
printInfo(formatDeferredAuthMessage(envName, results.authType));
|
|
358
|
+
return;
|
|
359
|
+
}
|
|
360
|
+
if (results.authType === 'oauth') {
|
|
361
|
+
await this.config.runCommand('env:auth', [envName]);
|
|
362
|
+
}
|
|
363
|
+
await this.config.runCommand('env:update', [envName]);
|
|
364
|
+
printSuccess(`✔ Env "${envName}" is ready.`);
|
|
365
|
+
}
|
|
366
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import { Args, Command, Flags } from '@oclif/core';
|
|
10
|
+
import { getCurrentEnvName, getEnv, resolveConfiguredAuthType, updateEnvConnection, } from '../../lib/auth-store.js';
|
|
11
|
+
import { resolveDefaultConfigScope } from '../../lib/cli-home.js';
|
|
12
|
+
import { authenticateEnvWithOauth } from '../../lib/env-auth.js';
|
|
13
|
+
import { runPromptCatalog } from '../../lib/prompt-catalog.js';
|
|
14
|
+
import { failTask, printStage, startTask, stopTask, succeedTask } from '../../lib/ui.js';
|
|
15
|
+
import EnvAdd from "./add.js";
|
|
16
|
+
const envAuthPrompts = {
|
|
17
|
+
authType: EnvAdd.prompts.authType,
|
|
18
|
+
accessToken: EnvAdd.prompts.accessToken,
|
|
19
|
+
};
|
|
20
|
+
function resolveExplicitAuthType(value) {
|
|
21
|
+
return value === 'token' || value === 'oauth' ? value : undefined;
|
|
22
|
+
}
|
|
23
|
+
function formatMissingEnvMessage(envName) {
|
|
24
|
+
return [
|
|
25
|
+
`Env "${envName}" is not configured.`,
|
|
26
|
+
`Run \`nb env add ${envName} --api-base-url <url>\` first.`,
|
|
27
|
+
].join('\n');
|
|
28
|
+
}
|
|
29
|
+
export default class EnvAuth extends Command {
|
|
30
|
+
static summary = 'Authenticate a saved NocoBase environment with a token or OAuth';
|
|
31
|
+
static examples = [
|
|
32
|
+
'<%= config.bin %> <%= command.id %>',
|
|
33
|
+
'<%= config.bin %> <%= command.id %> prod',
|
|
34
|
+
'<%= config.bin %> <%= command.id %> prod --auth-type token --access-token <api-key>',
|
|
35
|
+
];
|
|
36
|
+
static args = {
|
|
37
|
+
name: Args.string({
|
|
38
|
+
description: 'Configured environment name to sign in to. Defaults to the current env when omitted',
|
|
39
|
+
required: false,
|
|
40
|
+
}),
|
|
41
|
+
};
|
|
42
|
+
static flags = {
|
|
43
|
+
env: Flags.string({
|
|
44
|
+
char: 'e',
|
|
45
|
+
hidden: true,
|
|
46
|
+
deprecated: true,
|
|
47
|
+
description: 'Environment name (same as the optional positional argument; for compatibility with -e/--env on other commands)',
|
|
48
|
+
}),
|
|
49
|
+
'auth-type': Flags.string({
|
|
50
|
+
char: 'a',
|
|
51
|
+
description: 'Authentication: token (API key) or oauth (browser login)',
|
|
52
|
+
options: ['token', 'oauth'],
|
|
53
|
+
}),
|
|
54
|
+
'access-token': Flags.string({
|
|
55
|
+
char: 't',
|
|
56
|
+
description: 'API key or access token when using token authentication',
|
|
57
|
+
}),
|
|
58
|
+
};
|
|
59
|
+
async run() {
|
|
60
|
+
const { args, flags } = await this.parse(EnvAuth);
|
|
61
|
+
const nameArg = args.name?.trim();
|
|
62
|
+
const nameFlag = flags.env?.trim() || undefined;
|
|
63
|
+
if (nameArg && nameFlag && nameArg !== nameFlag) {
|
|
64
|
+
this.error(`Environment name was provided both as the argument ("${nameArg}") and as --env ("${nameFlag}"). Please use only one.`);
|
|
65
|
+
}
|
|
66
|
+
if (flags['auth-type'] === 'oauth' && flags['access-token'] !== undefined) {
|
|
67
|
+
this.error('--access-token cannot be used with --auth-type oauth.');
|
|
68
|
+
}
|
|
69
|
+
const envName = nameArg || nameFlag || (await getCurrentEnvName({ scope: resolveDefaultConfigScope() }));
|
|
70
|
+
const env = await getEnv(envName, { scope: resolveDefaultConfigScope() });
|
|
71
|
+
if (!env) {
|
|
72
|
+
this.error(formatMissingEnvMessage(envName));
|
|
73
|
+
}
|
|
74
|
+
const tokenFromFlags = flags['access-token'];
|
|
75
|
+
const tokenFlagProvided = tokenFromFlags !== undefined;
|
|
76
|
+
const tokenProvided = typeof tokenFromFlags === 'string' && tokenFromFlags !== '';
|
|
77
|
+
if (tokenFlagProvided && !tokenProvided) {
|
|
78
|
+
this.error('--access-token cannot be empty.');
|
|
79
|
+
}
|
|
80
|
+
const explicitAuthType = resolveExplicitAuthType(flags['auth-type']);
|
|
81
|
+
const savedAuthType = resolveConfiguredAuthType(env.config);
|
|
82
|
+
const resolvedAuthType = explicitAuthType ?? (tokenProvided ? 'token' : savedAuthType);
|
|
83
|
+
const prompted = (resolvedAuthType === 'oauth'
|
|
84
|
+
? { authType: 'oauth' }
|
|
85
|
+
: resolvedAuthType === 'token' && tokenProvided
|
|
86
|
+
? { authType: 'token', accessToken: tokenFromFlags }
|
|
87
|
+
: await runPromptCatalog(envAuthPrompts, {
|
|
88
|
+
values: {
|
|
89
|
+
...(resolvedAuthType ? { authType: resolvedAuthType } : {}),
|
|
90
|
+
},
|
|
91
|
+
command: this,
|
|
92
|
+
})) ?? {};
|
|
93
|
+
const authType = resolveExplicitAuthType(prompted.authType ?? resolvedAuthType);
|
|
94
|
+
if (!authType) {
|
|
95
|
+
this.error('Choose an authentication type before continuing.');
|
|
96
|
+
}
|
|
97
|
+
printStage('Authenticating');
|
|
98
|
+
try {
|
|
99
|
+
if (authType === 'token') {
|
|
100
|
+
const accessToken = String(prompted.accessToken ?? tokenFromFlags ?? '');
|
|
101
|
+
if (accessToken.trim() === '') {
|
|
102
|
+
this.error('--access-token cannot be empty.');
|
|
103
|
+
}
|
|
104
|
+
startTask(`Saving access token for "${envName}"...`);
|
|
105
|
+
await updateEnvConnection(envName, {
|
|
106
|
+
authType: 'token',
|
|
107
|
+
accessToken,
|
|
108
|
+
}, { scope: resolveDefaultConfigScope() });
|
|
109
|
+
stopTask();
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
startTask(`Starting browser sign-in for "${envName}"...`);
|
|
113
|
+
await updateEnvConnection(envName, {
|
|
114
|
+
authType: 'oauth',
|
|
115
|
+
}, { scope: resolveDefaultConfigScope() });
|
|
116
|
+
await authenticateEnvWithOauth({
|
|
117
|
+
envName,
|
|
118
|
+
scope: resolveDefaultConfigScope(),
|
|
119
|
+
});
|
|
120
|
+
stopTask();
|
|
121
|
+
}
|
|
122
|
+
await this.config.runCommand('env:update', [envName]);
|
|
123
|
+
succeedTask(`✔ Authenticated "${envName}".`);
|
|
124
|
+
}
|
|
125
|
+
catch (error) {
|
|
126
|
+
failTask(`Authentication failed for "${envName}".`);
|
|
127
|
+
throw error;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import { Command } from '@oclif/core';
|
|
10
|
+
import { getCurrentEnvName } from '../../lib/auth-store.js';
|
|
11
|
+
import { resolveDefaultConfigScope } from '../../lib/cli-home.js';
|
|
12
|
+
export default class EnvCurrent extends Command {
|
|
13
|
+
static summary = 'Show the current environment name';
|
|
14
|
+
static examples = [
|
|
15
|
+
'<%= config.bin %> <%= command.id %>',
|
|
16
|
+
];
|
|
17
|
+
async run() {
|
|
18
|
+
await this.parse(EnvCurrent);
|
|
19
|
+
this.log(await getCurrentEnvName({ scope: resolveDefaultConfigScope() }));
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import { Args, Command, Flags } from '@oclif/core';
|
|
10
|
+
import { formatMissingManagedAppEnvMessage, resolveManagedAppRuntime } from '../../lib/app-runtime.js';
|
|
11
|
+
import { resolveBuiltinDbConnection } from '../../lib/builtin-db.js';
|
|
12
|
+
import { renderTable } from '../../lib/ui.js';
|
|
13
|
+
import { appRootPath, dbStatus, runtimeStatus, storagePath } from './shared.js';
|
|
14
|
+
function normalizeJsonValue(value) {
|
|
15
|
+
if (value === undefined || value === null || value === '') {
|
|
16
|
+
return '-';
|
|
17
|
+
}
|
|
18
|
+
if (typeof value === 'boolean' || typeof value === 'number') {
|
|
19
|
+
return value;
|
|
20
|
+
}
|
|
21
|
+
return String(value);
|
|
22
|
+
}
|
|
23
|
+
function normalizeValue(value) {
|
|
24
|
+
if (value === undefined || value === null || value === '') {
|
|
25
|
+
return '-';
|
|
26
|
+
}
|
|
27
|
+
if (typeof value === 'boolean') {
|
|
28
|
+
return value ? 'true' : 'false';
|
|
29
|
+
}
|
|
30
|
+
return String(value);
|
|
31
|
+
}
|
|
32
|
+
function maskSecret(value, showSecrets) {
|
|
33
|
+
const normalized = normalizeValue(value);
|
|
34
|
+
if (normalized === '-') {
|
|
35
|
+
return normalized;
|
|
36
|
+
}
|
|
37
|
+
return showSecrets ? normalized : '********';
|
|
38
|
+
}
|
|
39
|
+
function createGroupTable(title, values) {
|
|
40
|
+
const rows = Object.entries(values).map(([field, value]) => [field, normalizeValue(value)]);
|
|
41
|
+
return `${title}\n${renderTable(['Field', 'Value'], rows)}`;
|
|
42
|
+
}
|
|
43
|
+
function serializeGroup(values) {
|
|
44
|
+
return Object.fromEntries(Object.entries(values).map(([field, value]) => [field, normalizeJsonValue(value)]));
|
|
45
|
+
}
|
|
46
|
+
export default class EnvInfo extends Command {
|
|
47
|
+
static hidden = false;
|
|
48
|
+
static description = 'Show grouped details for the selected NocoBase env, including app, database, API, and auth settings.';
|
|
49
|
+
static examples = [
|
|
50
|
+
'<%= config.bin %> <%= command.id %> app1',
|
|
51
|
+
'<%= config.bin %> <%= command.id %> app1 --json',
|
|
52
|
+
'<%= config.bin %> <%= command.id %> app1 --show-secrets',
|
|
53
|
+
];
|
|
54
|
+
static args = {
|
|
55
|
+
name: Args.string({
|
|
56
|
+
description: 'Configured environment name to inspect. Defaults to the current env when omitted',
|
|
57
|
+
required: false,
|
|
58
|
+
}),
|
|
59
|
+
};
|
|
60
|
+
static flags = {
|
|
61
|
+
env: Flags.string({
|
|
62
|
+
char: 'e',
|
|
63
|
+
hidden: true,
|
|
64
|
+
deprecated: true,
|
|
65
|
+
description: 'Environment name (same as the optional positional argument; for compatibility with -e/--env on other commands)',
|
|
66
|
+
}),
|
|
67
|
+
json: Flags.boolean({
|
|
68
|
+
description: 'Output the result as JSON',
|
|
69
|
+
default: false,
|
|
70
|
+
}),
|
|
71
|
+
'show-secrets': Flags.boolean({
|
|
72
|
+
description: 'Show secret values in plain text',
|
|
73
|
+
default: false,
|
|
74
|
+
}),
|
|
75
|
+
};
|
|
76
|
+
async run() {
|
|
77
|
+
const { args, flags } = await this.parse(EnvInfo);
|
|
78
|
+
const envNameArg = args.name?.trim() || undefined;
|
|
79
|
+
const envNameFlag = flags.env?.trim() || undefined;
|
|
80
|
+
if (envNameArg && envNameFlag && envNameArg !== envNameFlag) {
|
|
81
|
+
this.error(`Environment name was provided both as the argument ("${envNameArg}") and as --env ("${envNameFlag}"). Please use only one.`);
|
|
82
|
+
}
|
|
83
|
+
const requestedEnv = envNameArg || envNameFlag;
|
|
84
|
+
const showSecrets = flags['show-secrets'];
|
|
85
|
+
const runtime = await resolveManagedAppRuntime(requestedEnv);
|
|
86
|
+
if (!runtime) {
|
|
87
|
+
this.error(formatMissingManagedAppEnvMessage(requestedEnv));
|
|
88
|
+
}
|
|
89
|
+
const auth = runtime.env.auth;
|
|
90
|
+
const builtinDbConnection = (runtime.kind === 'local' || runtime.kind === 'docker') && runtime.env.config.builtinDb
|
|
91
|
+
? await resolveBuiltinDbConnection(runtime)
|
|
92
|
+
: undefined;
|
|
93
|
+
const appGroup = {
|
|
94
|
+
appRootPath: appRootPath(runtime),
|
|
95
|
+
storagePath: storagePath(runtime),
|
|
96
|
+
appPort: runtime.env.config.appPort,
|
|
97
|
+
appStatus: await runtimeStatus(runtime),
|
|
98
|
+
source: runtime.source,
|
|
99
|
+
downloadVersion: runtime.env.config.downloadVersion,
|
|
100
|
+
dockerRegistry: runtime.env.config.dockerRegistry,
|
|
101
|
+
dockerPlatform: runtime.env.config.dockerPlatform,
|
|
102
|
+
timezone: runtime.env.config.timezone,
|
|
103
|
+
};
|
|
104
|
+
const dbGroup = {
|
|
105
|
+
databaseStatus: await dbStatus(runtime),
|
|
106
|
+
builtinDb: runtime.env.config.builtinDb,
|
|
107
|
+
dbDialect: runtime.env.config.dbDialect,
|
|
108
|
+
builtinDbImage: runtime.env.config.builtinDbImage,
|
|
109
|
+
dbHost: builtinDbConnection?.dbHost ?? runtime.env.config.dbHost,
|
|
110
|
+
dbPort: builtinDbConnection?.dbPort ?? runtime.env.config.dbPort,
|
|
111
|
+
dbDatabase: runtime.env.config.dbDatabase,
|
|
112
|
+
dbUser: runtime.env.config.dbUser,
|
|
113
|
+
dbPassword: maskSecret(runtime.env.config.dbPassword, showSecrets),
|
|
114
|
+
};
|
|
115
|
+
const authGroup = {
|
|
116
|
+
type: auth?.type,
|
|
117
|
+
expiresAt: auth?.type === 'oauth' ? auth.expiresAt : undefined,
|
|
118
|
+
scope: auth?.type === 'oauth' ? auth.scope : undefined,
|
|
119
|
+
issuer: auth?.type === 'oauth' ? auth.issuer : undefined,
|
|
120
|
+
clientId: auth?.type === 'oauth' ? auth.clientId : undefined,
|
|
121
|
+
resource: auth?.type === 'oauth' ? auth.resource : undefined,
|
|
122
|
+
accessToken: maskSecret(auth?.accessToken, showSecrets),
|
|
123
|
+
refreshToken: maskSecret(auth?.type === 'oauth' ? auth.refreshToken : undefined, showSecrets),
|
|
124
|
+
};
|
|
125
|
+
const apiGroup = {
|
|
126
|
+
apiBaseUrl: runtime.env.apiBaseUrl,
|
|
127
|
+
'auth.type': authGroup.type,
|
|
128
|
+
'auth.expiresAt': authGroup.expiresAt,
|
|
129
|
+
'auth.scope': authGroup.scope,
|
|
130
|
+
'auth.issuer': authGroup.issuer,
|
|
131
|
+
'auth.clientId': authGroup.clientId,
|
|
132
|
+
'auth.resource': authGroup.resource,
|
|
133
|
+
'auth.accessToken': authGroup.accessToken,
|
|
134
|
+
'auth.refreshToken': authGroup.refreshToken,
|
|
135
|
+
};
|
|
136
|
+
const output = {
|
|
137
|
+
ok: true,
|
|
138
|
+
env: runtime.envName,
|
|
139
|
+
kind: runtime.kind,
|
|
140
|
+
app: serializeGroup(appGroup),
|
|
141
|
+
db: serializeGroup(dbGroup),
|
|
142
|
+
api: {
|
|
143
|
+
apiBaseUrl: normalizeJsonValue(runtime.env.apiBaseUrl),
|
|
144
|
+
auth: serializeGroup(authGroup),
|
|
145
|
+
},
|
|
146
|
+
};
|
|
147
|
+
if (flags.json) {
|
|
148
|
+
this.log(JSON.stringify(output, null, 2));
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
this.log([
|
|
152
|
+
createGroupTable('App', appGroup),
|
|
153
|
+
createGroupTable('DB', dbGroup),
|
|
154
|
+
createGroupTable('API', apiGroup),
|
|
155
|
+
].join('\n\n'));
|
|
156
|
+
}
|
|
157
|
+
}
|