Commit 37e2cf2
authored
[CDTOOL-1097] feat(env): Add environment variable for extending the UserAgent string. (#1502)
The environment variable FASTLY_USER_AGENT_EXTENSION can be used to
supply a string which will be inserted into the User-Agent header in
requests sent to the Fastly API; the existing strings representing the
Fastly CLI version and go-fastly version (when applicable) will still be
present.
All Submissions:
* [X] Have you followed the guidelines in our Contributing document?
* [X] Have you checked to ensure there aren't other open [Pull
Requests](https://github.com/fastly/cli/pulls) for the same
update/change?
Test - before:
```
kpfleming@kpfleming:~/src/fastly/cli$ FASTLY_DEBUG_MODE=true ./fastly whoami
http.Request (dump): "GET /verify HTTP/1.1\r\nHost: api.fastly.com\r\nAccept: application/json\r\nFastly-Key: <redacted>\r\nUser-Agent: FastlyCLI/v0.0.0-unknown\r\n\r\n"
```
Test - after:
```
kpfleming@kpfleming:~/src/fastly/cli$ FASTLY_USER_AGENT_EXTENSION=test1234 FASTLY_DEBUG_MODE=true ./fastly whoami
http.Request (dump): "GET /verify HTTP/1.1\r\nHost: api.fastly.com\r\nAccept: application/json\r\nFastly-Key: <redacted>\r\nUser-Agent: FastlyCLI/v0.0.0-unknown, test1234\r\n\r\n"
```1 parent d8235ef commit 37e2cf2
File tree
6 files changed
+31
-14
lines changed- pkg
- app
- commands/version
- config
- env
- useragent
6 files changed
+31
-14
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
9 | 11 | | |
10 | 12 | | |
11 | 13 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| 41 | + | |
41 | 42 | | |
42 | 43 | | |
43 | 44 | | |
| |||
152 | 153 | | |
153 | 154 | | |
154 | 155 | | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
155 | 168 | | |
156 | 169 | | |
157 | 170 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
12 | | - | |
13 | 11 | | |
14 | 12 | | |
15 | 13 | | |
16 | 14 | | |
17 | | - | |
18 | 15 | | |
19 | 16 | | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | 17 | | |
29 | 18 | | |
30 | 19 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
458 | 458 | | |
459 | 459 | | |
460 | 460 | | |
461 | | - | |
462 | | - | |
463 | | - | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
464 | 467 | | |
465 | 468 | | |
466 | 469 | | |
| |||
471 | 474 | | |
472 | 475 | | |
473 | 476 | | |
| 477 | + | |
474 | 478 | | |
475 | 479 | | |
476 | 480 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
43 | 48 | | |
44 | 49 | | |
45 | 50 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
0 commit comments