Make the entrypoint.sh more generic

This commit is contained in:
Scott Wallace 2022-03-29 18:58:44 +01:00
parent 66b22a64f8
commit 14db4d3398
Signed by: scott
GPG key ID: AA742FDC5AFE2A72

View file

@ -3,15 +3,19 @@
ARCH=$(uname -m) ARCH=$(uname -m)
BIN_DIR=/app/linux-${ARCH} BIN_DIR=/app/linux-${ARCH}
DATA_DIR=/etc/nebula DATA_DIR=/etc/nebula
HOSTNAME=$(hostname)
if test -z "${NEBULA_IP}"; then
echo "You did not set a value for the environment variable NEBULA_IP"
exit 2
fi
# --------------------- TESTING ONLY ------------------------ # --------------------- TESTING ONLY ------------------------
# Build certs if they don't exist # Build certs if they don't exist
if ! test -f ${DATA_DIR}/ca.key; then if ! test -f ${DATA_DIR}/ca.key; then
cd ${DATA_DIR} || exit 1 cd ${DATA_DIR} || exit 1
"${BIN_DIR}/nebula-cert" ca -name "Infranet" "${BIN_DIR}/nebula-cert" ca -name "Infranet"
"${BIN_DIR}/nebula-cert" sign -name "lighthouse" -ip "10.10.100.1/24" "${BIN_DIR}/nebula-cert" sign -name "${HOSTNAME}" -ip "${NEBULA_IP}" -out-key host.key -out-crt host.crt
mv lighthouse.crt host.crt
mv lighthouse.key host.key
fi fi
# ----------------------------------------------------------- # -----------------------------------------------------------