Can I specify several dars to be uploaded when using the `daml start` command?
- gyorgybalazsiOP
I know I can pass several dars to the
daml sandboxcommand to be uploaded to Sandbox.In addition to uploading several dars, I also would like to run a script after Sandbox is ready, which is possible using the
--on-startoption of thedaml startcommand.I would like to combine these two features.
- cocreature 1
There is no builtin feature for this. You have a few options:
- Don’t use daml start. You can use
daml sandbox --port-file portfileand then wait forportfileto be created as an indication that sandbox is up. Even in something like a bash script waiting for a file to be created is reasonably simple. - A DAR includes its dependencies. So if your project depends on other DARs, those should get uploaded as well. Note that you actually need to use them though (as in have a reference to them). Just putting them in
data-dependenciesisn’t going to include them. - You could put
daml ledger upload-darcommands in youron-startscript.
- Don’t use daml start. You can use
- gyorgybalazsi
Thank you!
- rikotacards 1
For some practical examples, in my
start.shfile, I have something like :cantonPortFile="./canton-sandbox-port.txt" jsonApiPortFile="./json-api-port.txt"daml sandbox --dar main/Asset/asset.dar --dar main/User/user.dar --dar main/Account/account.dar --port-file ${cantonPortFile}The below waits for the sandbox file to be created, then you can run another command after, for example, I’ll allocate parties.
waitForSandBox(){ while [ ! -f "$cantonPortFile" ]; do echo "Setting up sandbox..." if [ "$timeout" == 0 ]; then echo "ERROR: Timeout while waiting for the file ${cantonPortFile}" exit 1 sleep 2 # or less like 0.2 fi sleep 1 ((timeout--)) done echo "Canton sandBox setup complete" }The json api server can also create a port-file, which outputs the file once the server is setup, which you can then run triggers.
{ server { address = "localhost" port = 7575 port-file="json-api-port.txt" } ledger-api { address = "localhost" port = 6865 } }