2024-12-02 00:15:39 +00:00
|
|
|
#!/bin/bash
|
|
|
|
PUBLIC_IP=$(curl https://ipinfo.io/ip --silent)
|
|
|
|
HOSTNAME=$(hostname)
|
2024-12-03 22:48:54 +00:00
|
|
|
CONFIG_FILE=/pds/pds.env
|
2024-12-02 00:15:39 +00:00
|
|
|
|
|
|
|
function main {
|
|
|
|
|
|
|
|
if [[ -z "${PDS_JWT_SECRET}" ]]; then
|
|
|
|
echo "PDS_JWT_SECRET not specified"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ -z "${PDS_ADMIN_PASSWORD}" ]]; then
|
|
|
|
echo "PDS_ADMIN_PASSWORD not specified"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ -z "${PDS_PLC_ROTATION_KEY_K256_PRIVATE_KEY_HEX}" ]]; then
|
|
|
|
echo "PDS_PLC_ROTATION_KEY_K256_PRIVATE_KEY_HEX not specified"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2024-12-10 20:08:12 +00:00
|
|
|
# if hostname is not the same as the PDS_HOSTNAME then quit
|
|
|
|
if [[ "${PDS_HOSTNAME}" != "${HOSTNAME}" ]]; then
|
|
|
|
echo "PDS_HOSTNAME does not match the hostname"
|
2024-12-03 22:48:54 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# create the config if it does not exist
|
|
|
|
if [[ ! -f ${CONFIG_FILE} ]]; then
|
|
|
|
echo "PDS_JWT_SECRET=${PDS_JWT_SECRET}" >${CONFIG_FILE}
|
|
|
|
echo "PDS_ADMIN_PASSWORD=${PDS_ADMIN_PASSWORD}" >>${CONFIG_FILE}
|
|
|
|
echo "PDS_PLC_ROTATION_KEY_K256_PRIVATE_KEY_HEX=${PDS_PLC_ROTATION_KEY_K256_PRIVATE_KEY_HEX}" >>${CONFIG_FILE}
|
|
|
|
echo "PDS_HOSTNAME=${PDS_HOSTNAME}" >>${CONFIG_FILE}
|
|
|
|
echo "PDS_CRAWLERS=https://bsky.network" >>${CONFIG_FILE}
|
|
|
|
fi
|
|
|
|
|
2024-12-02 00:15:39 +00:00
|
|
|
cat <<STARTED_MESSAGE
|
|
|
|
========================================================================
|
|
|
|
PDS Started
|
|
|
|
------------------------------------------------------------------------
|
|
|
|
|
2024-12-03 22:48:54 +00:00
|
|
|
HOSTNAME: ${HOSTNAME}
|
|
|
|
PUBLIC_IP: ${PUBLIC_IP}
|
|
|
|
PDS_HOSTNAME: ${PDS_HOSTNAME}
|
2024-12-02 00:15:39 +00:00
|
|
|
|
|
|
|
========================================================================
|
|
|
|
STARTED_MESSAGE
|
|
|
|
|
|
|
|
node --enable-source-maps index.js
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
main
|