-
-
Notifications
You must be signed in to change notification settings - Fork 193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: support private registry options in asyncapi generate fromTemplate
command
#1091
feat: support private registry options in asyncapi generate fromTemplate
command
#1091
Conversation
Signed-off-by: Shiva953 <[email protected]>
'registry-auth': Flags.string({ | ||
description: 'The registry username and password encoded with base64, formatted as username:password' | ||
}), | ||
'registry-token': Flags.string({ | ||
description: 'The npm registry authentication token, that can be passed instead of base64 encoded username and password' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think it will make more sense if we take registryUsername
and registryPassword
as input from the user
'registry-auth': Flags.string({ | |
description: 'The registry username and password encoded with base64, formatted as username:password' | |
}), | |
'registry-token': Flags.string({ | |
description: 'The npm registry authentication token, that can be passed instead of base64 encoded username and password' | |
'registry-username': Flags.string({ | |
description: 'The username for the private registry.', | |
}), | |
'registry-password': Flags.string({ | |
description: 'The password for the private registry.', | |
}), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, that was also my initial concern I raised under the issue. Though in the example described here we are directly providing the base64 encoded value, wouldn't it make sense to do the same here too?
@@ -122,6 +132,9 @@ export default class Template extends Command { | |||
noOverwriteGlobs: flags['no-overwrite'], | |||
mapBaseUrlToFolder: parsedFlags.mapBaseUrlToFolder, | |||
disabledHooks: parsedFlags.disableHooks, | |||
registryUrl: parsedFlags.registryUrl, | |||
registryAuth: flags['registry-auth'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
registry auth should be change with base 64 value as mentioned in this
You can do this in something like this
const registryAuth = registryUsername && registryPassword
? Buffer.from(`${registryUsername}:${registryPassword}`).toString('base64')
: undefined;
@@ -122,6 +132,9 @@ export default class Template extends Command { | |||
noOverwriteGlobs: flags['no-overwrite'], | |||
mapBaseUrlToFolder: parsedFlags.mapBaseUrlToFolder, | |||
disabledHooks: parsedFlags.disableHooks, | |||
registryUrl: parsedFlags.registryUrl, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the default URL of registryUrl
should be https://registry.npmjs.org
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure
any updates on this? |
@Shiva953 can you check, some tests are not passing |
Quality Gate passedIssues Measures |
Quality Gate passedIssues Measures |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please take a look into generator and how new flag works. There is documentation available.
option on generator is called registry
and it is an object of 3 values
url - auth - token
you need to adjust your code accordingly and only stuff that is available
so if username and password is not available - then you cannot use it 😄
the way people should use generator in CI is always through token and auth that represents encoded username and password
it is all because of security
so you need to enable CLI user to pass all there different flags (which you already have - you just have to properly pass them to generator
@Shiva953 any updates ? |
We can close this PR as it's already solved: #1399 |
Description
asyncapi generate fromTemplate
command, in order to support private registry options such that user can pass customregistry.url
and specific authorization method, likeregistry.auth
orregistry.token
Related issue(s)
#1081