Files
ark/server/cmd/arkd/main.go
Louis Singer bb208ec995 Implements SQLite repositories (#180)
* add sqlite db

* add .vscode to gitignore

* add vtxo repo

* add sqlite repos implementations

* add sqlite in db/service

* update go.mod

* fix sqlite

* move sqlite tests to service_test.go + fixes

* integration tests using sqlite + properly close statements

* implement GetRoundsIds

* add "tx" table to store forfeits, connectors and congestion trees

* add db max conn = 1

* upsert VTXO + fix onboarding

* remove json tags

* Fixes

* Fix

* fix lint

* fix config.go

* Fix rm config & open db only once

* Update makefile

---------

Co-authored-by: altafan <18440657+altafan@users.noreply.github.com>
2024-06-19 18:16:31 +02:00

70 lines
1.6 KiB
Go
Executable File

package main
import (
"os"
"os/signal"
"syscall"
appconfig "github.com/ark-network/ark/internal/app-config"
"github.com/ark-network/ark/internal/config"
grpcservice "github.com/ark-network/ark/internal/interface/grpc"
log "github.com/sirupsen/logrus"
)
//nolint:all
var (
version = "dev"
commit = "none"
date = "unknown"
)
func main() {
cfg, err := config.LoadConfig()
if err != nil {
log.WithError(err).Fatal("invalid config")
}
log.SetLevel(log.Level(cfg.LogLevel))
svcConfig := grpcservice.Config{
Port: cfg.Port,
NoTLS: cfg.NoTLS,
AuthUser: cfg.AuthUser,
AuthPass: cfg.AuthPass,
}
appConfig := &appconfig.Config{
EventDbType: cfg.EventDbType,
DbType: cfg.DbType,
DbDir: cfg.DbDir,
EventDbDir: cfg.DbDir,
RoundInterval: cfg.RoundInterval,
Network: cfg.Network,
SchedulerType: cfg.SchedulerType,
TxBuilderType: cfg.TxBuilderType,
BlockchainScannerType: cfg.BlockchainScannerType,
WalletAddr: cfg.WalletAddr,
MinRelayFee: cfg.MinRelayFee,
RoundLifetime: cfg.RoundLifetime,
UnilateralExitDelay: cfg.UnilateralExitDelay,
}
svc, err := grpcservice.NewService(svcConfig, appConfig)
if err != nil {
log.Fatal(err)
}
log.RegisterExitHandler(svc.Stop)
log.Info("starting service...")
if err := svc.Start(); err != nil {
log.Fatal(err)
}
sigChan := make(chan os.Signal, 1)
signal.Notify(sigChan, syscall.SIGTERM, syscall.SIGINT)
<-sigChan
log.Info("shutting down service...")
log.Exit(0)
}