mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-23 15:00:30 +01:00
Inject Config directly into BisqGrpcServer
There is no need or benefit to injecting Config into CoreApi for the purpose of accessing it indirectly through BisqGrpcServer.
This commit is contained in:
parent
fe9e57babb
commit
506e12da46
3 changed files with 9 additions and 13 deletions
|
@ -22,6 +22,8 @@ import bisq.core.payment.PaymentAccount;
|
|||
import bisq.core.trade.handlers.TransactionResultHandler;
|
||||
import bisq.core.trade.statistics.TradeStatistics2;
|
||||
|
||||
import bisq.common.config.Config;
|
||||
|
||||
import bisq.proto.grpc.GetBalanceGrpc;
|
||||
import bisq.proto.grpc.GetBalanceReply;
|
||||
import bisq.proto.grpc.GetBalanceRequest;
|
||||
|
@ -65,6 +67,7 @@ public class BisqGrpcServer {
|
|||
private Server server;
|
||||
|
||||
private static BisqGrpcServer instance;
|
||||
private static Config config;
|
||||
private static CoreApi coreApi;
|
||||
|
||||
|
||||
|
@ -170,9 +173,10 @@ public class BisqGrpcServer {
|
|||
// Constructor
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public BisqGrpcServer(CoreApi coreApi) {
|
||||
public BisqGrpcServer(Config config, CoreApi coreApi) {
|
||||
instance = this;
|
||||
|
||||
BisqGrpcServer.config = config;
|
||||
BisqGrpcServer.coreApi = coreApi;
|
||||
|
||||
try {
|
||||
|
@ -201,8 +205,8 @@ public class BisqGrpcServer {
|
|||
private void start() throws IOException {
|
||||
// TODO add to options
|
||||
int port = 9998;
|
||||
String rpcUser = coreApi.getConfig().rpcUser;
|
||||
String rpcPassword = coreApi.getConfig().rpcPassword;
|
||||
String rpcUser = config.rpcUser;
|
||||
String rpcPassword = config.rpcPassword;
|
||||
|
||||
// Config services
|
||||
server = ServerBuilder.forPort(port)
|
||||
|
|
|
@ -32,7 +32,6 @@ import bisq.core.trade.statistics.TradeStatisticsManager;
|
|||
import bisq.core.user.User;
|
||||
|
||||
import bisq.common.app.Version;
|
||||
import bisq.common.config.Config;
|
||||
|
||||
import org.bitcoinj.core.Coin;
|
||||
|
||||
|
@ -50,7 +49,6 @@ import lombok.extern.slf4j.Slf4j;
|
|||
*/
|
||||
@Slf4j
|
||||
public class CoreApi {
|
||||
private final Config config;
|
||||
private final Balances balances;
|
||||
private final BalancePresentation balancePresentation;
|
||||
private final OfferBookService offerBookService;
|
||||
|
@ -60,15 +58,13 @@ public class CoreApi {
|
|||
private final User user;
|
||||
|
||||
@Inject
|
||||
public CoreApi(Config config,
|
||||
Balances balances,
|
||||
public CoreApi(Balances balances,
|
||||
BalancePresentation balancePresentation,
|
||||
OfferBookService offerBookService,
|
||||
TradeStatisticsManager tradeStatisticsManager,
|
||||
CreateOfferService createOfferService,
|
||||
OpenOfferManager openOfferManager,
|
||||
User user) {
|
||||
this.config = config;
|
||||
this.balances = balances;
|
||||
this.balancePresentation = balancePresentation;
|
||||
this.offerBookService = offerBookService;
|
||||
|
@ -78,10 +74,6 @@ public class CoreApi {
|
|||
this.user = user;
|
||||
}
|
||||
|
||||
public Config getConfig() {
|
||||
return config;
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return Version.VERSION;
|
||||
}
|
||||
|
|
|
@ -99,6 +99,6 @@ public class BisqDaemonMain extends BisqHeadlessAppMain implements BisqSetup.Bis
|
|||
super.onApplicationStarted();
|
||||
|
||||
CoreApi coreApi = injector.getInstance(CoreApi.class);
|
||||
new BisqGrpcServer(coreApi);
|
||||
new BisqGrpcServer(config, coreApi);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue