-
Notifications
You must be signed in to change notification settings - Fork 2
/
docker_entrypoint.sh
executable file
·50 lines (41 loc) · 1.21 KB
/
docker_entrypoint.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash
set -e
export HELIPAD_DATABASE_DIR="/data/db/database.db"
export HELIPAD_LISTEN_PORT="2112"
export HELIPAD_RUNAS_USER="helipad"
export HELIPAD_PASSWORD=$(yq -r .password /data/start9/config.yaml)
export LND_ADMINMACAROON="/mnt/lnd/admin.macaroon"
export LND_TLSCERT="/mnt/lnd/tls.cert"
export LND_URL="lnd.embassy:10009"
if ! [ -f $LND_ADMINMACAROON ]; then
echo "LND admin macaroon doesn't exist"
exit 1
fi
if ! [ -d "/data/db" ]; then
echo "Creating database directory"
mkdir -p /data/db
touch /data/db/database.db
chown -R helipad:helipad /data/db
fi
if ! [ -f "/usr/local/share/ca-certificates/cert.crt" ]; then
echo "Trusting Start OS certificate"
cd /usr/local/share/ca-certificates/
awk 'split_after==1{n++;split_after=0} /-----END CERTIFICATE-----/ {split_after=1} {print > "cert" n ".crt"}' < /mnt/lnd/tls.cert
update-ca-certificates
fi
echo "Writing properties"
cat << EOF > /data/start9/stats.yaml
---
version: 2
data:
Password:
type: string
value: $HELIPAD_PASSWORD
description: Copy this password to login. Change this value in Config.
copyable: true
qr: false
masked: true
EOF
echo "Starting Helipad..."
cd /opt/helipad
exec tini -g -- /opt/helipad/helipad