-
Notifications
You must be signed in to change notification settings - Fork 32
feat: add useragent #341
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
base: master
Are you sure you want to change the base?
feat: add useragent #341
Changes from all commits
ad48d09
e8f6587
b9e0c59
c64c1ad
f9dc11c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -85,6 +85,19 @@ class RuntimeBaseCommand extends Command { | |
| } else if (flags.debug) { | ||
| createDebug.enable(flags.debug) | ||
| } | ||
|
|
||
| // set User-Agent for runtime calls | ||
| // ex. aio-cli-plugin-runtime/@adobe/aio-cli/10.3.1 (darwin-arm64; node-v18.20.4; zsh) | ||
| const vs = this.config.versionDetails | ||
| const baseUserAgent = `aio-cli-plugin-runtime/${vs?.cliVersion || 'unknown'}` | ||
| const userAgentDetails = [vs?.architecture, vs?.nodeVersion, vs?.shell] | ||
| .filter(detail => typeof detail === 'string' && detail.trim()) | ||
| // console.log('init ', this.config.versionDetails) | ||
| process.env.__OW_USER_AGENT = userAgentDetails.length > 0 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Commented-out console.log debug statement should be removed before merging to keep the code clean. |
||
| ? `${baseUserAgent} (${userAgentDetails.join('; ')})` | ||
| : baseUserAgent | ||
|
|
||
| debug('init ', process.env.__OW_USER_AGENT) | ||
|
Comment on lines
+89
to
+100
|
||
| } | ||
|
|
||
| async handleError (msg, err) { | ||
|
|
||
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 example UA in the comment doesn’t match what the code generates (example includes
@adobe/aio-cli/...and anode-v...format, while the actual string isaio-cli-plugin-runtime/${vs?.cliVersion} (...)). Update the comment to reflect the real output so it stays useful as documentation.