Skip to content

Commit

Permalink
chore: rename base64 env variables
Browse files Browse the repository at this point in the history
  • Loading branch information
ngutech21 committed Feb 14, 2024
1 parent 9cfb83c commit eb1efe6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
4 changes: 4 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ MINT_LND_TLS_CERT_PATH="/../tls.cert"
# the host and port of the lnd grpc api
MINT_LND_GRPC_HOST="https://localhost:10004"

# (optional) base64 encoded macaroon and tls certificate instead of the file paths
MINT_LND_MACAROON_BASE64="base64 encoded macaroon"
MINT_LND_TLS_CERT_BASE64="base64 encoded tls cert"


# (optional) onchain backend for the mint. Uses the same configuration as the lnd lightning backend
#MINT_BTC_ONCHAIN_BACKEND=Lnd
Expand Down
14 changes: 6 additions & 8 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
#!/bin/sh

if [ -z "$LND_MACAROON_BASE64" ] || [ -z "$LND_TLS_CERT_BASE64" ]; then
echo "Warning: LND_MACAROON_BASE64 and LND_TLS_CERT_BASE64 not set" >&2
if [ -z "$MINT_LND_MACAROON_BASE64" ] || [ -z "$MINT_LND_TLS_CERT_BASE64" ]; then
echo "Warning: MINT_LND_MACAROON_BASE64 and MINT_LND_TLS_CERT_BASE64 not set" >&2
exec "$@"
exit 0
fi

# Decode the base64 environment variables and write them to files
mkdir -p /tmp/lndconf
echo "$LND_MACAROON_BASE64" | base64 -d > /tmp/lndconf/admin.macaroon
echo "$MINT_LND_MACAROON_BASE64" | base64 -d > /tmp/lndconf/admin.macaroon
if [ $? -ne 0 ]; then
echo "LND_MACAROON_BASE64 is not valid base64"
echo "MINT_LND_MACAROON_BASE64 is not valid base64"
exit 1
fi

echo "$LND_TLS_CERT_BASE64" | base64 -d > /tmp/lndconf/tls.cert
echo "$MINT_LND_TLS_CERT_BASE64" | base64 -d > /tmp/lndconf/tls.cert
if [ $? -ne 0 ]; then
echo "LND_TLS_CERT_BASE64 is not valid base64"
echo "MINT_LND_TLS_CERT_BASE64 is not valid base64"
exit 1
fi

Expand All @@ -25,7 +25,5 @@ chmod 700 /tmp/lndconf
chmod 400 /tmp/lndconf/admin.macaroon
chmod 400 /tmp/lndconf/tls.cert

#chown -R 1000:1000 /tmp/lndconf

# Start your application
exec "$@"

0 comments on commit eb1efe6

Please sign in to comment.