|
1 | 1 | package org.lfdecentralizedtrust.splice.integration.plugins.toxiproxy |
2 | 2 |
|
3 | 3 | import org.lfdecentralizedtrust.splice.config.{SpliceConfig, ParticipantClientConfig} |
| 4 | +import org.lfdecentralizedtrust.splice.sv.config.SvParticipantClientConfig |
4 | 5 | import org.lfdecentralizedtrust.splice.environment.EnvironmentImpl |
5 | 6 | import org.lfdecentralizedtrust.splice.integration.tests.SpliceTests.SpliceTestConsoleEnvironment |
6 | 7 | import org.lfdecentralizedtrust.splice.scan.admin.api.client.BftScanConnection.BftScanClientConfig |
@@ -35,20 +36,35 @@ case class UseToxiproxy( |
35 | 36 | proxies += (name -> proxy) |
36 | 37 | } |
37 | 38 |
|
| 39 | + def addLedgerApiProxy( |
| 40 | + instanceName: String, |
| 41 | + participantClient: SvParticipantClientConfig, |
| 42 | + extraPortBump: Int, |
| 43 | + ): SvParticipantClientConfig = { |
| 44 | + val bump = portBump + extraPortBump |
| 45 | + val lapiHost = participantClient.ledgerApi.clientConfig.address |
| 46 | + val lapiPort = participantClient.ledgerApi.clientConfig.port |
| 47 | + val upstream = s"${lapiHost}:${lapiPort}" |
| 48 | + val listenPort = lapiPort + bump |
| 49 | + addProxy(s"${instanceName}-ledger-api", s"localhost:${listenPort}", upstream) |
| 50 | + participantClient.focus(_.ledgerApi.clientConfig).modify(c => c.copy(port = c.port + bump)) |
| 51 | + } |
| 52 | + |
| 53 | + def addLedgerApiProxy( |
| 54 | + instanceName: String, |
| 55 | + participantClient: ParticipantClientConfig, |
| 56 | + extraPortBump: Int, |
| 57 | + ): ParticipantClientConfig = { |
| 58 | + val bump = portBump + extraPortBump |
| 59 | + val lapiHost = participantClient.ledgerApi.clientConfig.address |
| 60 | + val lapiPort = participantClient.ledgerApi.clientConfig.port |
| 61 | + val upstream = s"${lapiHost}:${lapiPort}" |
| 62 | + val listenPort = lapiPort + bump |
| 63 | + addProxy(s"${instanceName}-ledger-api", s"localhost:${listenPort}", upstream) |
| 64 | + participantClient.focus(_.ledgerApi.clientConfig).modify(c => c.copy(port = c.port + bump)) |
| 65 | + } |
| 66 | + |
38 | 67 | override def beforeEnvironmentCreated(config: SpliceConfig): SpliceConfig = { |
39 | | - def addLedgerApiProxy( |
40 | | - instanceName: String, |
41 | | - participantClient: ParticipantClientConfig, |
42 | | - extraPortBump: Int, |
43 | | - ): ParticipantClientConfig = { |
44 | | - val bump = portBump + extraPortBump |
45 | | - val lapiHost = participantClient.ledgerApi.clientConfig.address |
46 | | - val lapiPort = participantClient.ledgerApi.clientConfig.port |
47 | | - val upstream = s"${lapiHost}:${lapiPort}" |
48 | | - val listenPort = lapiPort + bump |
49 | | - addProxy(s"${instanceName}-ledger-api", s"localhost:${listenPort}", upstream) |
50 | | - participantClient.focus(_.ledgerApi.clientConfig).modify(c => c.copy(port = c.port + bump)) |
51 | | - } |
52 | 68 |
|
53 | 69 | def addScanAppHttpProxy( |
54 | 70 | instanceName: String, |
|
0 commit comments