Skip to content

Commit

Permalink
feat_: status-backend
Browse files Browse the repository at this point in the history
  • Loading branch information
igor-sirotin committed Sep 23, 2024
1 parent 4d5e6ee commit 16a4a48
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions cmd/status-backend/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package main

import (
"flag"
stdlog "log"
"os"

"golang.org/x/crypto/ssh/terminal"

"github.com/ethereum/go-ethereum/log"

"github.com/status-im/status-go/cmd/statusd/server"
"github.com/status-im/status-go/logutils"
)

var (
address = flag.String("address", "", "host:port to listen")
logger = log.New("package", "status-go/cmd/status-backend")
)

func init() {
logSettings := logutils.LogSettings{
Enabled: true,
MobileSystem: false,
Level: "INFO",
}
colors := terminal.IsTerminal(int(os.Stdin.Fd()))
if err := logutils.OverrideRootLogWithConfig(logSettings, colors); err != nil {
stdlog.Fatalf("failed to initialize log: %v", err)
}
}

func main() {
flag.Parse()

srv := server.NewServer()
srv.Setup()

err := srv.Listen(*address)
if err != nil {
logger.Error("failed to start server", "error", err)
return
}

log.Info("server started", "address", srv.Address())
srv.RegisterMobileAPI()
srv.Serve()
}

0 comments on commit 16a4a48

Please sign in to comment.