Skip to content
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

Codebase Server: remove the generated port and token #5461

Merged
merged 2 commits into from
Dec 10, 2024

Conversation

hojberg
Copy link
Member

@hojberg hojberg commented Nov 20, 2024

Run the CodebaseServer with a default port and token as well as allowing UCM Desktop domains to perform CORS requests.

Keep the command line options to set a specific port, token, and add allow CORS domains.T

@hojberg hojberg requested a review from ChrisPenner November 20, 2024 17:46
@hojberg hojberg force-pushed the remove-generated-port-token-and-cors branch 2 times, most recently from 9eef182 to 5371b2d Compare November 20, 2024 18:54
Copy link
Contributor

@ChrisPenner ChrisPenner left a comment

Choose a reason for hiding this comment

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

Looks good 👍🏼

Is there any documentation that needs updating as well?

@ChrisPenner
Copy link
Contributor

P.s. looks like you need to remove cryptonite from the appropriate package now that it's not used as well :)

@hojberg hojberg force-pushed the remove-generated-port-token-and-cors branch 3 times, most recently from 4c63cf4 to 3fcd4cb Compare November 21, 2024 16:45
@aryairani
Copy link
Contributor

Should we be making sure we're binding on localhost and not all interfaces? (iirc it was doing the the latter but I'm not able to check at the moment)

@hojberg
Copy link
Member Author

hojberg commented Nov 26, 2024

@aryairani I think I'll need help sorting that out.

@aryairani
Copy link
Contributor

aryairani commented Nov 26, 2024

@aryairani I think I'll need help sorting that out.

I'm learning too, but it looks like that's happening here:

let baseUrl = BaseUrl (fromMaybe "http://127.0.0.1" (host opts)) token
let settings =
defaultSettings
& maybe id setPort (port opts)
& maybe id (setHost . fromString) (host opts)

defaultSettings allows connections on any IPv4 address, but I'm thinking we should use something like setHost "127.0.0.1" instead of id for when it's not specified in the CodebaseServerOpts, which I think comes from UCM_HOST.

But this raises a question. On line 465 we expect (host opts)/UCM_HOST to be an IP address etc., but on line 461 it looks like we expect it to be a URL. What's the semantic meaning of this variable supposed to be currently? cc @hojberg

@hojberg hojberg force-pushed the remove-generated-port-token-and-cors branch 3 times, most recently from 13ab260 to fbe929d Compare December 10, 2024 17:39
Run the CodebaseServer with a default port and token as well as
allowing UCM Desktop domains to perform CORS requests.

Keep the command line options to set a specific port,
token, and add allow CORS domains.T
@hojberg hojberg force-pushed the remove-generated-port-token-and-cors branch from fbe929d to 70127ad Compare December 10, 2024 17:54
@hojberg
Copy link
Member Author

hojberg commented Dec 10, 2024

@aryairani ok this is ready for another look I think.

hojberg added a commit to unisonweb/ucm-desktop that referenced this pull request Dec 10, 2024
Update UCM Desktop to connect to the API on
`http://127.0.0.1:5858/codebase/api` reflecting the recent UCM change
(unisonweb/unison#5461) to remove the
autogenerated port and token in favor of defaults.
hojberg added a commit to unisonweb/ucm-desktop that referenced this pull request Dec 10, 2024
Update UCM Desktop to connect to the API on
`http://127.0.0.1:5858/codebase/api` reflecting the recent UCM change
(unisonweb/unison#5461) to remove the
autogenerated port and token in favor of defaults.
@hojberg hojberg merged commit 0fa62a4 into trunk Dec 10, 2024
32 checks passed
@hojberg hojberg deleted the remove-generated-port-token-and-cors branch December 10, 2024 20:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants