1- { writeShellScriptBin , writeText , pabExe , staticPkg , cacert , coreutils , lib } :
1+ { writeShellScriptBin , writeText , pabExe , staticPkg , cacert , coreutils , lib , gnused } :
22let
33 dbFile = "/var/lib/pab/pab-core.db" ;
44
5- webserverPort = 9080 ;
6- walletPort = 8086 ;
7- nodePort = 8082 ;
8- chainIndexPort = 8083 ;
9- signingProcessPort = 8084 ;
10- metadataPort = 8085 ;
5+ # /var/lib isn't right but whatever
6+ pabYaml = "/var/lib/pab/pab.yaml" ;
117
12- slotZeroTime = 1591566291000 ; # POSIX time of 2020-06-07T21:44:51Z (Sunday, June 7, 2020 21:44:51)
8+ slotZeroTime = 1596059091000 ; # POSIX time of slot zeron is milliseconds. See note [Datetime to slot] in Marlowe.Slot
139 slotLengthMillis = 1000 ;
1410
1511 constantFee = 10 ; # Constant fee per transaction in lovelace
16- scriptsFeeFactor = 1 .0; # Factor by which to multiply the size-dependent scripts fee in lovelace
12+ scriptsFeeFactor = 0 .0; # Factor by which to multiply the size-dependent scripts fee in lovelace
1713
18- pabYaml = writeText "pab.yaml" ( builtins . toJSON {
14+ pabYamlIn = writeText "pab.yaml.in " ( builtins . toJSON {
1915 dbConfig = {
2016 dbConfigFile = dbFile ;
2117 dbConfigPoolSize = 20 ;
2218 } ;
2319
2420 pabWebserverConfig = {
25- baseUrl = "http://localhost:${ builtins . toString webserverPort } " ;
21+ baseUrl = "http://localhost:@WEBSERVER_PORT@ " ;
2622 staticDir = "${ staticPkg } " ;
2723 permissiveCorsPolicy = false ;
2824 } ;
2925
3026 walletServerConfig = {
31- baseUrl = "http://localhost:${ builtins . toString walletPort } " ;
27+ baseUrl = "http://localhost:@WALLET_PORT@ " ;
3228 wallet = {
3329 getWallet = 1 ;
3430 } ;
3531 } ;
3632
3733 nodeServerConfig = {
38- mscBaseUrl = "http://localhost:${ builtins . toString nodePort } " ;
34+ mscBaseUrl = "http://localhost:@NODE_PORT@ " ;
3935 mscSocketPath = "/tmp/node-server.sock" ;
4036 mscRandomTxInterval = 20000000 ;
4137 mscSlotConfig = {
5955 } ;
6056
6157 chainIndexConfig = {
62- ciBaseUrl = "http://localhost:${ builtins . toString chainIndexPort } " ;
58+ ciBaseUrl = "http://localhost:@CHAIN_INDEX_PORT@ " ;
6359 ciWatchedAddresses = [ ] ;
6460 } ;
6561
6864 } ;
6965
7066 signingProcessConfig = {
71- spBaseUrl = "http://localhost:${ builtins . toString signingProcessPort } " ;
67+ spBaseUrl = "http://localhost:@SIGNING_PROCESS_PORT@ " ;
7268 spWallet = {
7369 getWallet = "1" ;
7470 } ;
7571 } ;
76-
77- metadataServerConfig = {
78- mdBaseUrl = "http://localhost:${ builtins . toString metadataPort } " ;
79- } ;
8072 } ) ;
8173
8274 # Note: The db is dropped as a workaround for a problem with
@@ -100,6 +92,14 @@ writeShellScriptBin "entrypoint" ''
10092
10193 export SYSTEM_CERTIFICATE_PATH=${ cacert } /etc/ssl/certs/ca-bundle.crt
10294
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+
103103 ${ pab-init-cmd } /bin/pab-init-cmd
104104
105105 exec ${ pabExe } --config=${ pabYaml } all-servers
0 commit comments