Skip to content
CCPEDIAby Unity Nodes
App Development

Daml json-api --port-file ${portFile}, no output file?

2 posts160 views1 likesLast activity Jun 2022

  1. rikotacardsOP 1

    I’m trying to run daml json-api --port-file ./someFileName

    and I don’t get a file out.

    When I run
    daml sandbox --dar main/Asset/asset.dar --dar main/User/user.dar --dar main/Account/account.dar --port-file ./thisWorks.txt

    I’ll get the file.

    I saw in the warnings that the CLI args are deprecated method, and I should use the config file.
    I have the below, but how can I specify the output file?

    {
        server {
          address = "localhost"
          port = 7575
        }
        ledger-api {
          address = "localhost"
          port = 6865
        }
     
    }
    

    The output of running the below, you can see

    portFile=None
    
    daml json-api --port-file fileShouldBeHere --config json-api-app.conf
    11-06-2022 02:48:49.881 [main] INFO  com.daml.http.Main - Config(ledgerHost=localhost, ledgerPort=6865, address=localhost, httpPort=7575, portFile=None, packageReloadInterval=5 seconds, packageMaxInboundMessageSize=None, maxInboundMessageSize=4194304, tlsConfig=TlsConfiguration(false,None,None,None,None,REQUIRE,false,None), jdbcConfig=None, staticContentConfig=None, allowNonHttps=false, wsConfig=None, nonRepudiationCertificateFile=None, nonRepudiationPrivateKeyFile=None, nonRepudiationPrivateKeyAlgorithm=None, surrogateTpIdCacheMaxEntries=None), context: {instance_uuid: "efe51502-d981-4352-96b4-d6cf870e84b3"} 
    
  2. rikotacards

    After some trial and error, seems like this worked

    {
        server {
          address = "localhost"
          port = 7575
          port-file="localDevPortFile"
        }
        ledger-api {
          address = "localhost"
          port = 6865
        }  
    }
    

    How am I supposed to know the syntax for the json-api-app.conf, as in the field names? For example, the below it shows, ledgerHost, but in the conf file, it is not ledger-host but rather just port, yet for portFile, it is port-file

    Config(ledgerHost=localhost, ledgerPort=6865, address=localhost, httpPort=7575, portFile=Some(text), packageReloadInterval=5 seconds, packageMaxInboundMessageSize=None, maxInboundMessageSize=4194304, tlsConfig=TlsConfiguration(false,None,None,None,None,REQUIRE,false,None), jdbcConfig=None, staticContentConfig=None, allowNonHttps=false, wsConfig=None, nonRepudiationCertificateFile=None, nonRepudiationPrivateKeyFile=None, nonRepudiationPrivateKeyAlgorithm=None, surrogateTpIdCacheMaxEntries=None), context: {instance_uuid: "40d6bddf-415b-4f03-95b2-bd29bc1c072e"}