Skip to content

Commit

Permalink
Two small tweaks for ease of use (hyperledger-labs#300)
Browse files Browse the repository at this point in the history
* Print server running/stopped messages

That wasn't clear from docs or the 'running commentary'

Signed-off-by: Jacob Kopczynski <[email protected]>

* Export explorerconfig.json

Signed-off-by: Jacob Kopczynski <[email protected]>
  • Loading branch information
jkopczyn authored May 12, 2022
1 parent 3db0d34 commit 7a7ac14
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,9 @@ $ cd blockchain-explorer/app
$ createdb `whoami`
```
Connect to the PostgreSQL database and run DB status commands:
Connect to the PostgreSQL database and run DB status commands. To export the
settings from `app/explorerconfig.json` to the environment, run `source
app/exportConfig.sh`; this will set `$DATABASE_DATABASE` and related envvars.
* **Ubuntu**
Expand Down Expand Up @@ -373,7 +375,7 @@ $ npm run build
```

* `npm start`
* It will have the backend and GUI service up
* It will have the backend and GUI service up, for as long as the process runs

* `npm run app-stop`
* It will stop the node server
Expand Down
10 changes: 10 additions & 0 deletions app/exportConfig.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

echo "should be sourced"
jq . ./explorerconfig.json >/dev/null

export DATABASE_HOST=$(jq -r '.postgreSQL.host' ./explorerconfig.json)
export DATABASE_PORT=$(jq -r '.postgreSQL.port' ./explorerconfig.json)
export DATABASE_USERNAME=$(jq -r '.postgreSQL.username' ./explorerconfig.json)
export DATABASE_DATABASE=$(jq -r '.postgreSQL.database' ./explorerconfig.json)
export DATABASE_PASSWD=$(jq -r '.postgreSQL.passwd' ./explorerconfig.json)
7 changes: 7 additions & 0 deletions start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,11 @@ export LOG_CONSOLE_STDOUT=${LOG_CONSOLE_STDOUT:-false}
export DISCOVERY_AS_LOCALHOST=${DISCOVERY_AS_LOCALHOST:-true}
export EXPLORER_APP_ROOT=${EXPLORER_APP_ROOT:-dist}

function log_exit() {
echo "Server stopped"
exit
}
trap log_exit SIGINT EXIT
echo "Server running..."

node ${EXPLORER_APP_ROOT}/main.js name - hyperledger-explorer

0 comments on commit 7a7ac14

Please sign in to comment.