Open
Description
User story
As a user,
I want to be sure the token (API key) I set and use for uploading reports to portal is in correct format,
so I will get quick and understandable feedback that my token is missing or missconfigured.
Acceptance criteria
- validate the prefix
cp_
should always be present - validate the hash lenght as it is always 64 hexadecimal characters
- strip possible the unnecessary surrounding quotes
- the logic for validation/stripping should live in the
@code-pushup/portal-client
package and be consumed by the CLI
Implementation details
A regex of /^cp_[0-9a-f]{64}$/
could be used.
Additional pre-check if token is wrapped in "
or '
quotes as this could be done if user copy pastes from code or assumes it needs to be in explicit string format. We could recover easily by stripping the quotes.
Metadata
Metadata
Assignees
Labels
No labels