Skip to content

Commit

Permalink
[Server] Merge config and appConfig (#391)
Browse files Browse the repository at this point in the history
fix, do not export private function

fix

rebased
  • Loading branch information
aruokhai authored Feb 4, 2025
1 parent b9d1ef9 commit 3e481d5
Show file tree
Hide file tree
Showing 4 changed files with 450 additions and 523 deletions.
49 changes: 2 additions & 47 deletions server/cmd/arkd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,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 @@ -65,60 +64,16 @@ func mainAction(_ *cli.Context) error {
TLSExtraDomains: cfg.TLSExtraDomains,
}

vtxoTreeExpiryType, unilateralExitType, boardingExitType := common.LocktimeTypeBlock, common.LocktimeTypeBlock, common.LocktimeTypeBlock
if cfg.VtxoTreeExpiry >= 512 {
vtxoTreeExpiryType = 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,
EventDbDir: cfg.DbDir,
RoundInterval: cfg.RoundInterval,
Network: cfg.Network,
SchedulerType: cfg.SchedulerType,
TxBuilderType: cfg.TxBuilderType,
WalletAddr: cfg.WalletAddr,
VtxoTreeExpiry: common.RelativeLocktime{Type: vtxoTreeExpiryType, Value: uint32(cfg.VtxoTreeExpiry)},
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,
OtelCollectorEndpoint: cfg.OtelCollectorEndpoint,
AllowZeroFees: cfg.AllowZeroFees,
}

if cfg.AllowZeroFees {
log.Warn("WARNING: AllowZeroFees is enabled")
}

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 3e481d5

Please sign in to comment.