Skip to content

feat: allow setting port share protocol #12383

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Mar 6, 2024
Merged

feat: allow setting port share protocol #12383

merged 12 commits into from
Mar 6, 2024

Conversation

deansheather
Copy link
Member

@deansheather deansheather commented Mar 1, 2024

Adds protocol to port shares. Value can either be http or https. Previous port shares default to http. It's a required field in the API so clients must specify it from now on.

Frontend:
image

@f0ssel
Copy link
Contributor

f0ssel commented Mar 4, 2024

Looks good to me, thanks for plumbing that through, glad it was this simple of a change. I can handle the frontend if you want me to take over this PR from here.

@matifali
Copy link
Member

matifali commented Mar 5, 2024

Can we default it to http if not set instead of making it a required property?
Also, isn't it possible to parse the url to determine this and don't expose this entirely.

@deansheather
Copy link
Member Author

There is no URL in the request it's just a port, so the separate field is necessary. The frontend will default to HTTP but the API will require it as a field.

Comment on lines +2 to +9
SELECT
*
FROM
workspace_agent_port_share
WHERE
workspace_id = $1
AND agent_name = $2
AND port = $3;
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a formatter I should be using but am somehow missing?

Copy link
Member Author

Choose a reason for hiding this comment

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

Nope :( I just did it manually

Comment on lines +79 to +100
// list
list, err := client.GetWorkspaceAgentPortShares(ctx, r.Workspace.ID)
require.NoError(t, err)
require.Len(t, list.Shares, 1)
require.EqualValues(t, agents[0].Name, list.Shares[0].AgentName)
require.EqualValues(t, 8080, list.Shares[0].Port)
require.EqualValues(t, codersdk.WorkspaceAgentPortShareLevelPublic, list.Shares[0].ShareLevel)
require.EqualValues(t, codersdk.WorkspaceAgentPortShareProtocolHTTPS, list.Shares[0].Protocol)
Copy link
Contributor

Choose a reason for hiding this comment

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

thanks for adding this extra coverage

@f0ssel f0ssel force-pushed the dean/port-share-protocol branch from 99ed006 to c925496 Compare March 5, 2024 17:10
@f0ssel
Copy link
Contributor

f0ssel commented Mar 5, 2024

@matifali @stirby Here's the new looking frontend with the protocol field in place:
image

@f0ssel f0ssel self-assigned this Mar 5, 2024
@f0ssel
Copy link
Contributor

f0ssel commented Mar 5, 2024

@deansheather Please review my additions, and just comment since you can't review your own PR lol.

@f0ssel f0ssel requested a review from Kira-Pilot March 5, 2024 17:44
Copy link
Member Author

@deansheather deansheather left a comment

Choose a reason for hiding this comment

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

Garrett's changes look good to me 👍

@f0ssel f0ssel merged commit 46a2ff1 into main Mar 6, 2024
@f0ssel f0ssel deleted the dean/port-share-protocol branch March 6, 2024 14:23
@github-actions github-actions bot locked and limited conversation to collaborators Mar 6, 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.

3 participants