Skip to content

Commit

Permalink
merged duplicate server appConfig and Config Struct
Browse files Browse the repository at this point in the history
  • Loading branch information
aruokhai committed Dec 20, 2024
1 parent 7e4cb82 commit 644a654
Show file tree
Hide file tree
Showing 3 changed files with 407 additions and 54 deletions.
47 changes: 2 additions & 45 deletions server/cmd/arkd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"syscall"

"github.com/ark-network/ark/common"
appconfig "github.com/ark-network/ark/server/internal/app-config"
"github.com/ark-network/ark/server/internal/config"
grpcservice "github.com/ark-network/ark/server/internal/interface/grpc"
log "github.com/sirupsen/logrus"
Expand Down Expand Up @@ -59,54 +58,12 @@ func mainAction(_ *cli.Context) error {
TLSExtraDomains: cfg.TLSExtraDomains,
}

lifetimeType, unilateralExitType, boardingExitType := common.LocktimeTypeBlock, common.LocktimeTypeBlock, common.LocktimeTypeBlock
if cfg.RoundLifetime >= 512 {
lifetimeType = common.LocktimeTypeSecond
}
if cfg.UnilateralExitDelay >= 512 {
unilateralExitType = common.LocktimeTypeSecond
}
if cfg.BoardingExitDelay >= 512 {
boardingExitType = common.LocktimeTypeSecond
}

appConfig := &appconfig.Config{
EventDbType: cfg.EventDbType,
DbType: cfg.DbType,
DbDir: cfg.DbDir,
DbMigrationPath: cfg.DbMigrationPath,
EventDbDir: cfg.DbDir,
RoundInterval: cfg.RoundInterval,
Network: cfg.Network,
SchedulerType: cfg.SchedulerType,
TxBuilderType: cfg.TxBuilderType,
WalletAddr: cfg.WalletAddr,
RoundLifetime: common.RelativeLocktime{Type: lifetimeType, Value: uint32(cfg.RoundLifetime)},
UnilateralExitDelay: common.RelativeLocktime{Type: unilateralExitType, Value: uint32(cfg.UnilateralExitDelay)},
EsploraURL: cfg.EsploraURL,
NeutrinoPeer: cfg.NeutrinoPeer,
BitcoindRpcUser: cfg.BitcoindRpcUser,
BitcoindRpcPass: cfg.BitcoindRpcPass,
BitcoindRpcHost: cfg.BitcoindRpcHost,
BitcoindZMQBlock: cfg.BitcoindZMQBlock,
BitcoindZMQTx: cfg.BitcoindZMQTx,
BoardingExitDelay: common.RelativeLocktime{Type: boardingExitType, Value: uint32(cfg.BoardingExitDelay)},
UnlockerType: cfg.UnlockerType,
UnlockerFilePath: cfg.UnlockerFilePath,
UnlockerPassword: cfg.UnlockerPassword,
NostrDefaultRelays: cfg.NostrDefaultRelays,
NoteUriPrefix: cfg.NoteUriPrefix,
MarketHourStartTime: cfg.MarketHourStartTime,
MarketHourEndTime: cfg.MarketHourEndTime,
MarketHourPeriod: cfg.MarketHourPeriod,
MarketHourRoundInterval: cfg.MarketHourRoundInterval,
}
svc, err := grpcservice.NewService(svcConfig, appConfig)
svc, err := grpcservice.NewService(svcConfig, cfg)
if err != nil {
return err
}

log.Infof("Ark Server config: %+v", appConfig)
log.Infof("Ark Server config: %+v", cfg)

log.Info("starting service...")
if err := svc.Start(); err != nil {
Expand Down
Loading

0 comments on commit 644a654

Please sign in to comment.