Skip to content

chore: move app URL parsing to its own package - #11651

Merged
Emyrk merged 9 commits into
mainfrom
stevenmasley/ports_in_wildcard
Jan 17, 2024
Merged

Emyrk merged 9 commits into
mainfrom
stevenmasley/ports_in_wildcard

Conversation

@Emyrk

@Emyrk Emyrk commented Jan 16, 2024 •

Copy link
Copy Markdown
Member

What this does

Parsing CODER_WILDCARD_ACCESS_URL as a url.URL was always incorrect (see https://goplay.tools/snippet/YHUpcSkVrli). Since wildcard urls do not have a scheme, the url parsing was never accurate to how it parsed things. And it would not accept ports.

We have a wildcard parse function, so why not make that the validation instead of using the url and url.String().

Lastly I moved appurl to it's own package to avoid import loops. This is a reasonable thing to package.

In support of #8189. We need to move the field from a url to a string to support ports.

Emyrk commented Jan 16, 2024 •

Copy link
Copy Markdown
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @Emyrk and the rest of your teammates on Graphite Graphite

@Emyrk Emyrk changed the title chore: move app url parsing to it's own package chore: move app URL parsing to its own package Jan 16, 2024
@Emyrk
Emyrk marked this pull request as ready for review January 17, 2024 01:20
Comment on lines +13 to +14
// nameRegex is the same as our UsernameRegex without the ^ and $.
nameRegex = "[a-zA-Z0-9]+(?:-[a-zA-Z0-9]+)*"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it should still trim the old regex instead TBH

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because of import loops, we would need to put that regex in some other package then 😢.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

codersdk maybe?

@Emyrk Emyrk added release/breaking This label is applied to PRs to detect breaking changes as part of the release process and removed release/breaking This label is applied to PRs to detect breaking changes as part of the release process labels Jan 17, 2024
@Emyrk
Emyrk merged commit b246f08 into main Jan 17, 2024
@Emyrk
Emyrk deleted the stevenmasley/ports_in_wildcard branch January 17, 2024 16:41
@github-actions github-actions Bot locked and limited conversation to collaborators Jan 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants