mirror of
https://github.com/balena-io/balena-cli.git
synced 2024-12-19 21:57:51 +00:00
Warn user that api keys will not be shown again in future
This commit is contained in:
parent
0e5f2fe748
commit
834a2f1e4d
@ -188,7 +188,6 @@ environment variable (in the same standard URL format).
|
||||
|
||||
## api-key generate <name>
|
||||
|
||||
|
||||
This command generates a new API key for the current user, with the given
|
||||
name. The key will be logged to the console.
|
||||
|
||||
@ -199,7 +198,6 @@ Examples:
|
||||
|
||||
$ resin api-key generate "Jenkins Key"
|
||||
|
||||
|
||||
# Application
|
||||
|
||||
## app create <name>
|
||||
|
@ -1,26 +1,36 @@
|
||||
import { CommandDefinition } from 'capitano';
|
||||
import { stripIndent } from 'common-tags';
|
||||
|
||||
export const generate: CommandDefinition<{
|
||||
name: string;
|
||||
}> = {
|
||||
signature: 'api-key generate <name>',
|
||||
description: 'Generate a new API key with the given name',
|
||||
help: `
|
||||
This command generates a new API key for the current user, with the given
|
||||
name. The key will be logged to the console.
|
||||
help: stripIndent`
|
||||
This command generates a new API key for the current user, with the given
|
||||
name. The key will be logged to the console.
|
||||
|
||||
This key can be used to log into the CLI using 'resin login --token <key>',
|
||||
or to authenticate requests to the API with an 'Authorization: Bearer <key>' header.
|
||||
This key can be used to log into the CLI using 'resin login --token <key>',
|
||||
or to authenticate requests to the API with an 'Authorization: Bearer <key>' header.
|
||||
|
||||
Examples:
|
||||
Examples:
|
||||
|
||||
$ resin api-key generate "Jenkins Key"
|
||||
`,
|
||||
`,
|
||||
async action(params, _options, done) {
|
||||
const resin = (await import('resin-sdk')).fromSharedOptions();
|
||||
|
||||
resin.models.apiKey.create(params.name).then(key => {
|
||||
console.log(`Registered api key '${params.name}':\n${key}`);
|
||||
}).finally(done);
|
||||
resin.models.apiKey
|
||||
.create(params.name)
|
||||
.then(key => {
|
||||
console.log(stripIndent`
|
||||
Registered api key '${params.name}':
|
||||
|
||||
${key}
|
||||
|
||||
This key will not be shown again, so please save it now.
|
||||
`);
|
||||
})
|
||||
.finally(done);
|
||||
},
|
||||
};
|
||||
|
@ -57,6 +57,7 @@
|
||||
"devDependencies": {
|
||||
"@types/archiver": "^2.0.1",
|
||||
"@types/bluebird": "^3.5.19",
|
||||
"@types/common-tags": "^1.4.0",
|
||||
"@types/es6-promise": "0.0.32",
|
||||
"@types/fs-extra": "^5.0.0",
|
||||
"@types/is-root": "^1.0.0",
|
||||
@ -96,6 +97,7 @@
|
||||
"cli-truncate": "^1.1.0",
|
||||
"coffeescript": "^1.12.6",
|
||||
"columnify": "^1.5.2",
|
||||
"common-tags": "^1.7.2",
|
||||
"denymount": "^2.2.0",
|
||||
"docker-progress": "^3.0.1",
|
||||
"docker-qemu-transpose": "^0.5.1",
|
||||
|
Loading…
Reference in New Issue
Block a user