-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #223 from getAlby/feat/multi-entry
Feat: multi entry
- Loading branch information
Showing
11 changed files
with
132 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
//go:build !wails || http | ||
// +build !wails http | ||
|
||
// (http tag above is simply to fix go language server issue and is not needed to build the app) | ||
|
||
package main | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
"net/http" | ||
"time" | ||
|
||
echologrus "github.com/davrux/echo-logrus/v4" | ||
"github.com/labstack/echo/v4" | ||
log "github.com/sirupsen/logrus" | ||
) | ||
|
||
// ignore this warning: we use build tags | ||
// this function will only be executed if no wails tag is set | ||
func main() { | ||
log.Info("NWC Starting in HTTP mode") | ||
ctx := context.Background() | ||
svc := NewService(ctx) | ||
|
||
if svc.cfg.CookieSecret == "" { | ||
svc.Logger.Fatalf("required key COOKIE_SECRET missing value") | ||
} | ||
|
||
echologrus.Logger = svc.Logger | ||
e := echo.New() | ||
|
||
//register shared routes | ||
svc.RegisterSharedRoutes(e) | ||
//start Echo server | ||
go func() { | ||
if err := e.Start(fmt.Sprintf(":%v", svc.cfg.Port)); err != nil && err != http.ErrServerClosed { | ||
e.Logger.Fatalf("shutting down the server: %v", err) | ||
} | ||
}() | ||
//handle graceful shutdown | ||
<-svc.ctx.Done() | ||
svc.Logger.Infof("Shutting down echo server...") | ||
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) | ||
defer cancel() | ||
e.Shutdown(ctx) | ||
svc.Logger.Info("Echo server exited") | ||
svc.Logger.Info("Waiting for service to exit...") | ||
svc.wg.Wait() | ||
svc.Logger.Info("Service exited") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
//go:build wails | ||
// +build wails | ||
|
||
package main | ||
|
||
import ( | ||
"context" | ||
|
||
log "github.com/sirupsen/logrus" | ||
) | ||
|
||
// ignore this warning: we use build tags | ||
// this function will only be executed if the wails tag is set | ||
func main() { | ||
log.Info("NWC Starting in WAILS mode") | ||
ctx, cancel := context.WithCancel(context.Background()) | ||
svc := NewService(ctx) | ||
|
||
app := NewApp(svc) | ||
LaunchWailsApp(app) | ||
svc.Logger.Info("Wails app exited") | ||
|
||
svc.Logger.Info("Cancelling service context...") | ||
// cancel the service context | ||
cancel() | ||
svc.Logger.Info("Waiting for service to exit...") | ||
svc.wg.Wait() | ||
svc.Logger.Info("Service exited") | ||
} |
Oops, something went wrong.