-
Notifications
You must be signed in to change notification settings - Fork 60
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: embedded web ui #1182
feat: embedded web ui #1182
Changes from all commits
0ebe0f7
4904d3b
2da4882
5113e11
648c758
450b26d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -10,11 +10,13 @@ | |||||||||||||||
|
||||||||||||||||
"github.com/quicksilver-zone/quicksilver/app" | ||||||||||||||||
cmdcfg "github.com/quicksilver-zone/quicksilver/cmd/config" | ||||||||||||||||
webui "github.com/quicksilver-zone/quicksilver/web-ui" | ||||||||||||||||
) | ||||||||||||||||
|
||||||||||||||||
func main() { | ||||||||||||||||
cmdcfg.SetupConfig() | ||||||||||||||||
cmdcfg.RegisterDenoms() | ||||||||||||||||
webui.UI() // Start the web server. TODO: ensure that this is easy for operators to turn off, and that it handles cors or whatever. | ||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The call to
- webui.UI() // Start the web server. TODO: ensure that this is easy for operators to turn off, and that it handles cors or whatever.
+ err := webui.UI() // Start the web server.
+ if err != nil {
+ fmt.Println("Failed to start the web UI server:", err)
+ return
+ }
// TODO: Ensure that the web server can be easily turned off through configuration and that CORS is appropriately handled. Committable suggestion
Suggested change
|
||||||||||||||||
|
||||||||||||||||
userHomeDir, err := os.UserHomeDir() | ||||||||||||||||
if err != nil { | ||||||||||||||||
|
This file was deleted.
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,28 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
package webui | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
import ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"embed" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"fmt" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"net/http" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"time" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
//go:embed out/* | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Check failure on line 10 in web-ui/embed.go GitHub Actions / test quicksilver (amd64, linux)
Check failure on line 10 in web-ui/embed.go GitHub Actions / Analyze
Check failure on line 10 in web-ui/embed.go GitHub Actions / lint
Check failure on line 10 in web-ui/embed.go GitHub Actions / build quicksilver (amd64, linux)
Check failure on line 10 in web-ui/embed.go GitHub Actions / test quicksilver (amd64, windows)
Check failure on line 10 in web-ui/embed.go GitHub Actions / build quicksilver (amd64, windows)
Check failure on line 10 in web-ui/embed.go GitHub Actions / test quicksilver (darwin, arm64)
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
var webFS embed.FS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
func UI() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
http.Handle("/", http.FileServer(http.FS(webFS))) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
server := &http.Server{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Addr: ":8080", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Handler: nil, // Use default mux | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
ReadTimeout: 5 * time.Second, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
WriteTimeout: 10 * time.Second, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
IdleTimeout: 15 * time.Second, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
err := server.ListenAndServe() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if err != nil { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
fmt.Println("Error starting embedded web app server: ", err) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+13
to
+27
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The
func UI() error {
http.Handle("/", http.FileServer(http.FS(webFS)))
+ port := os.Getenv("WEB_UI_PORT")
+ if port == "" {
+ port = "8080" // Default port
+ }
server := &http.Server{
- Addr: ":8080",
+ Addr: ":" + port,
Handler: nil, // Use default mux (http.DefaultServeMux)
ReadTimeout: 5 * time.Second,
WriteTimeout: 10 * time.Second,
IdleTimeout: 15 * time.Second,
}
err := server.ListenAndServe()
if err != nil {
fmt.Println("Error starting embedded web app server: ", err)
+ return err
}
+ return nil
} Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} |
Check notice
Code scanning / devskim
A "TODO" or similar was left in source code, possibly indicating incomplete functionality Note