Init mode of the JSON API

Is my understanding right that there is no “init mode” for the JSON API.

What I mean by init mode is a way to start the JSON API in such a way that it will create the right schema on the DB and shuts down after.

I’m aware of the createSchema=true parameter as explained here, but my interpretation of the docs is that the service continues running after the initialization.

1 Like

The JSON API (and the same applies to the Trigger Service) will exit immediately if you use createSchema=true. So this should already do what you are asking for:

moritz@adjunction ~ [1]> daml json-api --query-store-jdbc-config "driver=org.postgresql.Driver,url=jdbc:postgresql://localhost:5432/db,user=u,password=p,createSchema=true" --ledger-host localhost --ledger-port 6865 --http-port 7500
16:08:14.492 [main] INFO  com.daml.http.Main$ - Config(ledgerHost=localhost, ledgerPort=6865, address=, httpPort=7500, portFile=None, packageReloadInterval=5 seconds, packageMaxInboundMessageSize=None, maxInboundMessageSize=4194304, tlsConfig=TlsConfiguration(false,None,None,None,REQUIRE,false,List()), jdbcConfig=Some(JdbcConfig(driver=org.postgresql.Driver, url=jdbc:postgresql://localhost:5432/db, user=u, createSchema=true)), staticContentConfig=None, allowNonHttps=false, accessTokenFile=None, wsConfig=None)
16:08:14.831 [] INFO  akka.event.slf4j.Slf4jLogger - Slf4jLogger started
16:08:14.960 [main] INFO  com.daml.http.Main$ - Creating DB schema...
16:08:15.188 [main] INFO  com.daml.http.Main$ - DB schema created. Terminating process...
moritz@adjunction ~>