The typical Canton example has the configuration files in HOCON format. That is really nice for human readability and editability.
Does Canton also accept configuration files in JSON format?
The typical Canton example has the configuration files in HOCON format. That is really nice for human readability and editability.
Does Canton also accept configuration files in JSON format?
Apparently so. I converted a HOCON configuration file into a JSON file using this CLI tool.
canton {
participants {
mynode {
ledger-api.address=localhost
}
}
}
hoconvert --file canton.conf --output json > canton.json
{
"canton": {
"participants": {
"mynode": {
"ledger-api": {
"address": "localhost"
}
}
}
}
}
Canton accepted both HOCON and JSON files without error:
docker run -it --rm \
--volume ./:/host/ \
digitalasset/canton-open-source:2.7.9 \
--config /host/canton.conf
participants.local.head.health.status
docker run -it --rm \
--volume ./:/host/ \
digitalasset/canton-open-source:2.7.9 \
--config /host/canton.json
participants.local.head.health.status
This could be helpful for script-based creation and editing of configuration files. There is simply more JSON-aware tooling available (e.g., jq
).
It is a property of HOCON that any valid JSON file is also a valid HOCON file.