1
0

Add ledgerbil command helper

This commit is contained in:
Tony Grosinger 2022-07-26 21:41:32 -07:00
parent 963aa81436
commit ada3fce905
2 changed files with 23 additions and 2 deletions

3
.env
View File

@ -2,7 +2,8 @@
CONFIG_DIR=config
# The parent folder containing your ledger files.
LEDGER_DIR=data
# This must be an absolute path.
LEDGER_DIR=/home/my-username/metaledger/data
# The name of your primary ledger file (within the LEDGER_DIR).
PRIMARY_LEDGER_FILE=all.ledger

22
bin/ledgerbil Normal file → Executable file
View File

@ -1,3 +1,23 @@
#!/bin/bash
echo TODO
# https://github.com/scarpent/ledgerbil
SCRIPTPATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
REPOPATH="$(dirname ${SCRIPTPATH})"
source ${REPOPATH}/.env
if ! docker image inspect "ledgerbil:latest" >/dev/null 2>&1; then
echo "Ledgerbil image not found. Building..."
git submodule update --init
pushd ledgerbil
docker build -t ledgerbil:latest .
popd
fi
docker run --rm -it \
-v "${LEDGER_DIR}:/data" \
-v "${REPOPATH}/ledgerbil-settings.py:/code/ledgerbil/settings.py" \
--entrypoint python \
ledgerbil:latest \
/code/main.py -f /data/${PRIMARY_LEDGER_FILE} ${@}