-
Notifications
You must be signed in to change notification settings - Fork 0
Migrate to pocketbase v0.30.4, removing echo dependency #870
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
Changes from all commits
92cf9c4
10ef5ed
85018f3
df44df3
8ab7a07
6610794
5268f30
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 |
|---|---|---|
|
|
@@ -21,8 +21,9 @@ import ( | |
|
|
||
| "github.com/hypebeast/go-osc/osc" | ||
| "github.com/kindlyops/vbs/embeddy" | ||
| "github.com/labstack/echo/v5" | ||
| "github.com/muesli/coral" | ||
| "github.com/pocketbase/pocketbase" | ||
|
Member
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. 🚫 [golangci] reported by reviewdog 🐶 |
||
| "github.com/pocketbase/pocketbase/core" | ||
|
Member
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. 🚫 [golangci] reported by reviewdog 🐶 |
||
| "github.com/rs/zerolog/log" | ||
| "github.com/spf13/viper" | ||
| ) | ||
|
|
@@ -50,14 +51,41 @@ func lightingBridge(cmd *coral.Command, args []string) { | |
| assetHandler := http.FileServer(http.FS(public)) | ||
|
|
||
| log.Debug().Msgf("Starting HTTP server at: http://%s\n", listenAddr) | ||
| e := echo.New() | ||
| e.GET("/*", echo.WrapHandler(assetHandler)) | ||
| e.POST("/api/switcher/*", echo.WrapHandler(&Switcher{})) | ||
| e.POST("/api/light/*", echo.WrapHandler(&Lighting{})) | ||
| err := e.Start(listenAddr) | ||
| app := pocketbase.New() | ||
|
Member
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. 🚫 [golangci] reported by reviewdog 🐶 |
||
|
|
||
| app.OnServe().BindFunc(func(serveEvent *core.ServeEvent) error { | ||
| // Serve static files | ||
| serveEvent.Router.GET("/*", func(re *core.RequestEvent) error { | ||
| assetHandler.ServeHTTP(re.Response, re.Request) | ||
|
|
||
| return nil | ||
| }) | ||
|
|
||
| // Switcher API endpoint | ||
| serveEvent.Router.POST("/api/switcher/*", func(re *core.RequestEvent) error { | ||
| switcher := &Switcher{} | ||
| switcher.ServeHTTP(re.Response, re.Request) | ||
|
|
||
| return nil | ||
| }) | ||
|
|
||
| // Lighting API endpoint | ||
| serveEvent.Router.POST("/api/light/*", func(re *core.RequestEvent) error { | ||
| lighting := &Lighting{} | ||
| lighting.ServeHTTP(re.Response, re.Request) | ||
|
|
||
| return nil | ||
| }) | ||
|
|
||
| // Override the server address | ||
| serveEvent.Server.Addr = listenAddr | ||
|
|
||
| return nil | ||
| }) | ||
|
|
||
| err := app.Start() | ||
| if err != nil { | ||
| log.Error().Err(err).Msg("error from echo.Start") | ||
| log.Error().Err(err).Msg("error from app.Start") | ||
| } | ||
| } | ||
|
|
||
|
|
||
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.
🚫 [golangci] reported by reviewdog 🐶
pocketbase.Config is missing fields HideStartBanner, DefaultDev, DefaultEncryptionEnv, DefaultQueryTimeout, DataMaxOpenConns, DataMaxIdleConns, AuxMaxOpenConns, AuxMaxIdleConns, DBConnect (exhaustruct)