Skip to content

api: add const for 'X-Registry-Auth'#42790

Closed
thaJeztah wants to merge 1 commit intomoby:masterfrom
thaJeztah:auth_header_const
Closed

api: add const for 'X-Registry-Auth'#42790
thaJeztah wants to merge 1 commit intomoby:masterfrom
thaJeztah:auth_header_const

Conversation

@thaJeztah
Copy link
Copy Markdown
Member

- Description for the changelog

- A picture of a cute animal (not mandatory but encouraged)

@thaJeztah thaJeztah added area/api API status/2-code-review kind/refactor PR's that refactor, or clean-up code labels Aug 26, 2021
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@tianon
Copy link
Copy Markdown
Member

tianon commented Aug 27, 2021

I'm not entirely convinced on this one -- I get that it's conceptually cleaner, but the end result is longer everywhere? 😬 😩 (and the likelihood of changing the value is slim to none)

(Probably just being overly superficial here -- I'm definitely not going to be a blocker on this. 🙈)

@thaJeztah
Copy link
Copy Markdown
Member Author

I'm not super strongly attached to this. My train of thought was that this is not a standard header (we defined it as part of our API).

From that perspective, I felt it would be useful to have a const defined that can be used by consumers of our API. We can also use the const to properly document the const; I actually should have added the information from https://github.com/moby/moby/blob/v20.10.8/api/swagger.yaml#L72-L93

Truth is that this started out with me digging into some of the authentication bits, and finding myself repeatedly grep for this string to see where all the auth logic was, and how it differed. The const helped me being lazy and have my IDE do that for me (jump to references) 😇 😂.

@tianon
Copy link
Copy Markdown
Member

tianon commented Aug 27, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/api API kind/refactor PR's that refactor, or clean-up code status/2-code-review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants