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

feat: improve stdout ux and run test frontent at /web #55

Merged
merged 5 commits into from
Aug 30, 2024

Conversation

lidel
Copy link
Member

@lidel lidel commented Aug 29, 2024

This PR

  • removes NPM build
  • improves stdout during startup, avoiding situation when user tries to use it while accelerated-dht is still mapping the DHT
  • embedd and serve static fronted at /web

Rationale

Since we dont need to do npm build, we can embedd frontend in the binary, and serve it on the same port as API + printlocalhost URL that can be used for testing

This removes the need for running separate http server for frontend, when developing locally.

Demo

$ go build
$ ./ipfs-check
Starting ipfs-check
...
2024/08/29 20:42:34 Please wait, initializing accelerated-dht client.. (mapping Amino DHT may takes 5 or more minutes)
2024/08/29 20:42:34 Accelerated DHT client ready
2024/08/29 20:46:59 Backend ready and listening on [::]:3333
2024/08/29 20:46:59 Test fronted at http://localhost:3333/web/?backendURL=http://localhost:3333
2024/08/29 20:46:59 Ready to start serving.

As a convenience, a test frontend is provided at http://localhost:3333/web/?backendURL=http://localhost:3333.

we have static assets only, telemetry was removed in
1d5329d
NPM brings no value
since we dont ened to do npm build, we can embedd frontend in the
binary, and serve it on the same port as API + printlocalhost URL
that can be used for testing

this removes the need for running separate http server for frontend,
when developing locally
@lidel lidel requested a review from 2color August 29, 2024 19:12
daemon.go Outdated
@@ -25,6 +26,9 @@ import (
"github.com/prometheus/client_golang/prometheus"
)

//go:embed web
var webFS embed.FS
Copy link
Member

Choose a reason for hiding this comment

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

What do you think about moving this to main.go?

Copy link
Member

Choose a reason for hiding this comment

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

I took the liberty of moving it. Hope that's ok.

@2color 2color merged commit 2f48510 into main Aug 30, 2024
11 checks passed
@2color 2color deleted the chore/remove-npm-build branch August 30, 2024 11:49
@2color
Copy link
Member

2color commented Aug 30, 2024

Thanks! This is a nice improvement

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.

2 participants