2024-09-27 15:02:18 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"flag"
|
|
|
|
stdlog "log"
|
|
|
|
"os"
|
|
|
|
|
|
|
|
"golang.org/x/crypto/ssh/terminal"
|
|
|
|
|
|
|
|
"github.com/ethereum/go-ethereum/log"
|
|
|
|
|
2024-10-04 13:24:36 +00:00
|
|
|
"github.com/status-im/status-go/cmd/status-backend/server"
|
2024-09-27 15:02:18 +00:00
|
|
|
"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()
|
|
|
|
}
|