Commit 40efbe8
authored
fix(scripts): unify Fly.io auth header handling (tldraw#8591)
`fetch-fly-logs.ts` was sending the raw token as the `Authorization`
header, while `fetch-fly-metrics.ts` correctly used the `FlyV1 <token>`
format. Additionally, if a user passed a token that already included the
`FlyV1 ` prefix (e.g. copied from a password manager), the metrics
script would double-prefix it.
This PR fixes both issues:
- `getFlyToken()` now strips any existing `FlyV1 ` prefix, so callers
always get a raw token
- `fetch-fly-logs.ts` now uses `FlyV1 ${token}` like
`fetch-fly-metrics.ts`
### Change type
- [x] `bugfix`
### Test plan
1. Run `fetch-fly-logs.ts` with a token that includes the `FlyV1 `
prefix — should work
2. Run `fetch-fly-logs.ts` with a raw token — should work
3. Run `fetch-fly-metrics.ts` with both token formats — should still
work
### Code changes
| Section | LOC change |
| -------------- | ---------- |
| Config/tooling | +11 / -7 |1 parent a0990db commit 40efbe8
2 files changed
Lines changed: 11 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
89 | | - | |
| 89 | + | |
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
21 | 25 | | |
22 | 26 | | |
23 | 27 | | |
| |||
0 commit comments