|
1 | | -{ writeShellScriptBin, writeText, pabExe, staticPkg, cacert, coreutils, lib }: |
| 1 | +{ writeShellScriptBin, writeText, pabExe, staticPkg, cacert, coreutils, lib, gnused }: |
2 | 2 | let |
3 | 3 | dbFile = "/var/lib/pab/pab-core.db"; |
4 | 4 |
|
5 | | - webserverPort = 9080; |
6 | | - walletPort = 8086; |
7 | | - nodePort = 8082; |
8 | | - chainIndexPort = 8083; |
9 | | - signingProcessPort = 8084; |
| 5 | + # /var/lib isn't right but whatever |
| 6 | + pabYaml = "/var/lib/pab/pab.yaml"; |
10 | 7 |
|
11 | 8 | slotZeroTime = 1596059091000; # POSIX time of slot zeron is milliseconds. See note [Datetime to slot] in Marlowe.Slot |
12 | 9 | slotLengthMillis = 1000; |
13 | 10 |
|
14 | 11 | constantFee = 10; # Constant fee per transaction in lovelace |
15 | 12 | scriptsFeeFactor = 0.0; # Factor by which to multiply the size-dependent scripts fee in lovelace |
16 | 13 |
|
17 | | - pabYaml = writeText "pab.yaml" (builtins.toJSON { |
| 14 | + pabYamlIn = writeText "pab.yaml.in" (builtins.toJSON { |
18 | 15 | dbConfig = { |
19 | 16 | dbConfigFile = dbFile; |
20 | 17 | dbConfigPoolSize = 20; |
21 | 18 | }; |
22 | 19 |
|
23 | 20 | pabWebserverConfig = { |
24 | | - baseUrl = "http://localhost:${builtins.toString webserverPort}"; |
| 21 | + baseUrl = "http://localhost:@WEBSERVER_PORT@"; |
25 | 22 | staticDir = "${staticPkg}"; |
26 | 23 | permissiveCorsPolicy = false; |
27 | 24 | }; |
28 | 25 |
|
29 | 26 | walletServerConfig = { |
30 | | - baseUrl = "http://localhost:${builtins.toString walletPort}"; |
| 27 | + baseUrl = "http://localhost:@WALLET_PORT@"; |
31 | 28 | wallet = { |
32 | 29 | getWallet = 1; |
33 | 30 | }; |
34 | 31 | }; |
35 | 32 |
|
36 | 33 | nodeServerConfig = { |
37 | | - mscBaseUrl = "http://localhost:${builtins.toString nodePort}"; |
| 34 | + mscBaseUrl = "http://localhost:@NODE_PORT@"; |
38 | 35 | mscSocketPath = "/tmp/node-server.sock"; |
39 | 36 | mscRandomTxInterval = 20000000; |
40 | 37 | mscSlotConfig = { |
|
58 | 55 | }; |
59 | 56 |
|
60 | 57 | chainIndexConfig = { |
61 | | - ciBaseUrl = "http://localhost:${builtins.toString chainIndexPort}"; |
| 58 | + ciBaseUrl = "http://localhost:@CHAIN_INDEX_PORT@"; |
62 | 59 | ciWatchedAddresses = [ ]; |
63 | 60 | }; |
64 | 61 |
|
|
67 | 64 | }; |
68 | 65 |
|
69 | 66 | signingProcessConfig = { |
70 | | - spBaseUrl = "http://localhost:${builtins.toString signingProcessPort}"; |
| 67 | + spBaseUrl = "http://localhost:@SIGNING_PROCESS_PORT@"; |
71 | 68 | spWallet = { |
72 | 69 | getWallet = "1"; |
73 | 70 | }; |
@@ -95,6 +92,14 @@ writeShellScriptBin "entrypoint" '' |
95 | 92 |
|
96 | 93 | export SYSTEM_CERTIFICATE_PATH=${cacert}/etc/ssl/certs/ca-bundle.crt |
97 | 94 |
|
| 95 | + ${gnused}/bin/sed -e "s|@WEBSERVER_PORT@|$((PORT_RANGE_BASE))|g" \ |
| 96 | + -e "s|@NODE_PORT@|$((PORT_RANGE_BASE + 1))|g" \ |
| 97 | + -e "s|@CHAIN_INDEX_PORT@|$((PORT_RANGE_BASE + 2))|g" \ |
| 98 | + -e "s|@SIGNING_PROCESS_PORT@|$((PORT_RANGE_BASE + 3))|g" \ |
| 99 | + -e "s|@WALLET_PORT@|$((PORT_RANGE_BASE + 4))|g" \ |
| 100 | + ${pabYamlIn} > ${pabYaml} |
| 101 | +
|
| 102 | +
|
98 | 103 | ${pab-init-cmd}/bin/pab-init-cmd |
99 | 104 |
|
100 | 105 | exec ${pabExe} --config=${pabYaml} all-servers |
|
0 commit comments