Skip to content

Commit

Permalink
Merge pull request #161 from c4dt/update_scripts
Browse files Browse the repository at this point in the history
Updating scripts
  • Loading branch information
ineiti committed May 13, 2024
2 parents 28ad738 + b56fbc6 commit 0ce24ab
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 31 deletions.
13 changes: 10 additions & 3 deletions scripts/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Scripts for running D-voting locally

The following scripts are available to configure and run D-voting locally. They should be called in this order:
The following scripts are available to configure and run D-voting locally.
They should be called in this order:

- `run_local.sh` - sets up a complete system with 4 nodes, the db, the authentication-server,
and the frontend.
Expand All @@ -10,8 +11,14 @@ The following scripts are available to configure and run D-voting locally. They
For debugging Dela, you still need to re-run everything.
- `local_proxies.sh` needs to be run once after the `run_local.sh` script
- `local_forms.sh` creates a new form and prints its ID
- `local_votes.sh` casts the given number of votes. THE ENCRYPTION IS WRONG AND WILL NOT WORK. But it allows to test
missing votes

Every script must be called from the root of the repository:

```bash
./scripts/run_local.sh
./scripts/local_proxies.sh
./scripts/local_forms.sh
```

The following script is only called by the other scripts:

Expand Down
3 changes: 2 additions & 1 deletion scripts/local_forms.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
. "$SCRIPT_DIR/local_login.sh"

echo "add form"
RESP=$(curl -sk "$FRONTEND_URL/api/evoting/forms" -X POST -H 'Content-Type: application/json' -b cookies.txt --data-raw '{"Title":{"En":"Something","Fr":"","De":""},"Scaffold":[{"ID":"99hYV4uy","Title":{"En":"More stuff","Fr":"","De":""},"Order":["0c7RSRKs"],"Ranks":[],"Selects":[{"ID":"0c7RSRKs","Title":{"En":"Choose","Fr":"","De":""},"MaxN":3,"MinN":1,"Choices":[{"Choice":"{\"en\":\"First\"}","URL":""},{"Choice":"{\"en\":\"Second\"}","URL":""},{"Choice":"{\"en\":\"Third\"}","URL":""}],"Hint":{"En":"","Fr":"","De":""}}],"Texts":[],"Subjects":[]}]}')
FORMJSON='{"Configuration":{"Title":{"En":"title","Fr":"","De":"","URL":""},"Scaffold":[{"ID":"ozCI7gKv","Title":{"En":"subtitle","Fr":"","De":"","URL":""},"Order":["nVjQ0jMK"],"Ranks":[],"Selects":[{"ID":"nVjQ0jMK","Title":{"En":"vote","Fr":"","De":"","URL":""},"MaxN":3,"MinN":1,"Choices":[{"Choice":"{\"en\":\"one\"}","URL":""},{"Choice":"{\"en\":\"two\"}","URL":""},{"Choice":"{\"en\":\"three\"}","URL":""}],"Hint":{"En":"","Fr":"","De":""}}],"Texts":[],"Subjects":[]}],"AdditionalInfo":""}}'
RESP=$(curl -sk "$FRONTEND_URL/api/evoting/forms" -X POST -H 'Content-Type: application/json' -b cookies.txt --data-raw "$FORMJSON")
FORMID=$(echo "$RESP" | jq -r .FormID)
echo "FORMID=$FORMID" > "$SCRIPT_DIR/formid.env"

Expand Down
20 changes: 0 additions & 20 deletions scripts/local_votes.sh

This file was deleted.

7 changes: 0 additions & 7 deletions scripts/run_local.sh
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,6 @@ function init_nodes() {

function init_dela() {
echo "Initializing dela"
echo " Share the certificate"
for n in $(seq 2 4); do
TOKEN_ARGS=$(dvoting --config ./nodes/node-1 minogrpc token)
NODEDIR=./nodes/node-$n
dvoting --config $NODEDIR minogrpc join --address grpc://localhost:2000 $TOKEN_ARGS
done

echo " Create a new chain with the nodes"
for n in $(seq 4); do
NODEDIR=./nodes/node-$n
Expand Down

0 comments on commit 0ce24ab

Please sign in to comment.