-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
feat: add $IPFS_PATH/gateway file #9156
Conversation
The file contains the gateway your node is hosting in the http://<host>:<port> format. Structurally it works exactly the same as the API file.
cc @lidel, @Stebalien, @SgtPooki, @aschmahmann and @TheDiscordian Note that @lidel offered to review this meaning it's just a "fyi" for the others. I'd like to get this in the next kubo (0.15.0) as ffmpeg already relies on this and curl is probably soon going to follow suit. |
Our new release policy is a linux like one, where whatever is ready (merged into master and not absolutely crashing everything) is released, anything else is just bumped down. We do that every 5 weeks (including a week of freeze / RC). The freeze start is |
Guess we have 2 1/2 week to get it "mergeable" then @Jorropo ;) I have no clue why some tests fail btw.. Any hint there? |
I've restarted the tests because the errors was weird, I do think it's related to your PR, we don't have THAT many flaky tests. |
@markg85 the linter is complaining, please run |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need defer
s because if your program return early (the Errorf
or Close
fail) you never run your cleanup code.
defer
s also run if the goroutine panic.
Co-authored-by: Jorropo <[email protected]>
Co-authored-by: Jorropo <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs green CI and a sharness test that confirms the file is created and includes URL matching the value in Addresses.Gateway
.
Green, yay :) |
Hi all, I added a testcase in the file that already has a slew of gateway tests in there. Seemed like the logical place (either that or the daemon test file). Is there anything else I need to do for this patch? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thx for your patch 🎉
@@ -806,6 +806,12 @@ func serveHTTPGateway(req *cmds.Request, cctx *oldcmds.Context) (<-chan error, e | |||
return nil, fmt.Errorf("serveHTTPGateway: ConstructNode() failed: %s", err) | |||
} | |||
|
|||
if len(listeners) > 0 { | |||
if err := node.Repo.SetGatewayAddr(listeners[0].Addr()); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems quite arbitrary to pick the index 0
, I would maybe add a filter to pick localhost
if possible but I don't think it's worth fixing.
The file contains the gateway your node is hosting in the http://: format.
Structurally it works exactly the same as the API file.
IPIP: ipfs/specs#280