2

I have a daml file with just one script

module User where
import Daml.Script
makeAdmin =
  script do
    admin <- allocateParty "Admin"
    submit admin do
      createCmd User with username = admin
template User with
    username: Party
  where
    signatory username

    key username: Party
    maintainer key
...

Is there a way to execute the script any time I run daml start?

pgp1
  • 103
  • 1
  • 13

1 Answers1

1

Yes! This is explained in the documentation for Daml Script, specifically:

You can use Daml script to initialize a ledger on startup. To do so, specify an init-script: ScriptExample:initializeFixed field in your daml.yaml. This will automatically be picked up by daml start and used to initialize sandbox.

In your case, that would be:

init-script: User:makeAdmin