dynamically create the pds.env file
This commit is contained in:
parent
a8905adfd6
commit
83f43f5466
1 changed files with 19 additions and 23 deletions
|
@ -1,24 +1,10 @@
|
|||
#!/bin/bash
|
||||
LOCAL_IP=$(hostname --all-ip-addresses | awk '{ print $1 }')
|
||||
PUBLIC_IP=$(curl https://ipinfo.io/ip --silent)
|
||||
HOSTNAME=$(hostname)
|
||||
CONFIG_FILE=/pds/pds.env
|
||||
|
||||
function main {
|
||||
|
||||
# pds hostname must be the same as the hostname of the container
|
||||
if [[ "${PDS_HOSTNAME}" != "${HOSTNAME}" ]]; then
|
||||
echo "PDS_HOSTNAME must be the same as the hostname of the container"
|
||||
echo "Set the hostname for the container before running."
|
||||
echo "Current hostname: ${HOSTNAME}"
|
||||
echo "PDS_HOSTNAME: ${PDS_HOSTNAME}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -z "${PDS_HOSTNAME}" ]]; then
|
||||
echo "No public DNS address specified"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -z "${PDS_JWT_SECRET}" ]]; then
|
||||
echo "PDS_JWT_SECRET not specified"
|
||||
exit 1
|
||||
|
@ -34,19 +20,29 @@ function main {
|
|||
exit 1
|
||||
fi
|
||||
|
||||
# set PDS_HOSTNAME to hostname if not set
|
||||
if [[ -z "${PDS_HOSTNAME}" ]]; then
|
||||
echo "PDS_HOSTNAME not specified"
|
||||
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
|
||||
|
||||
cat <<STARTED_MESSAGE
|
||||
========================================================================
|
||||
PDS Started
|
||||
------------------------------------------------------------------------
|
||||
|
||||
Hostname : ${PDS_HOSTNAME}
|
||||
: http://${PDS_HOSTNAME}:3000/xrpc/_health
|
||||
|
||||
Local IP : ${LOCAL_IP}
|
||||
: http://${LOCAL_IP}:3000/xrpc/_health
|
||||
|
||||
Public IP : ${PUBLIC_IP}
|
||||
: http://${PUBLIC_IP}:3000/xrpc/_health
|
||||
HOSTNAME: ${HOSTNAME}
|
||||
PUBLIC_IP: ${PUBLIC_IP}
|
||||
PDS_HOSTNAME: ${PDS_HOSTNAME}
|
||||
|
||||
========================================================================
|
||||
STARTED_MESSAGE
|
||||
|
|
Loading…
Reference in a new issue