dev api key

This commit is contained in:
Jonas Rabenstein 2026-08-12 14:02:12 +02:00
commit 89091a03d3
11 changed files with 791 additions and 762 deletions

View file

@ -80,6 +80,9 @@
mkdir -p "$PGHOST"
# Use an absolute path for the PostgreSQL Unix socket.
PGHOST_ABS="$(cd "$PGHOST" && pwd)"
# ============================================================
# Initialise PostgreSQL cluster
# ============================================================
@ -101,8 +104,6 @@
# Start PostgreSQL
#
# PostgreSQL is deliberately restricted to the Unix socket.
# No TCP/IP listener is opened, so there are no port conflicts
# with another local PostgreSQL instance.
# ============================================================
if ! pg_ctl \
@ -116,7 +117,7 @@
pg_ctl \
-D "$PGDATA" \
-l "$PGDATA/postgresql.log" \
-o "-c listen_addresses= -k $PGHOST" \
-o "-c listen_addresses= -k $PGHOST_ABS" \
start \
>/dev/null
fi
@ -129,7 +130,7 @@
for _ in $(seq 1 50); do
if pg_isready \
-h "$PGHOST" \
-h "$PGHOST_ABS" \
-U "$PGUSER" \
>/dev/null 2>&1
then
@ -164,7 +165,7 @@
# ============================================================
if ! psql \
-h "$PGHOST" \
-h "$PGHOST_ABS" \
-U "$PGUSER" \
-d postgres \
-tAc \
@ -177,7 +178,7 @@
echo "==> Creating PostgreSQL database '$PGDATABASE'"
createdb \
-h "$PGHOST" \
-h "$PGHOST_ABS" \
-U "$PGUSER" \
"$PGDATABASE"
fi
@ -190,7 +191,7 @@
echo "==> Checking PostGIS"
psql \
-h "$PGHOST" \
-h "$PGHOST_ABS" \
-U "$PGUSER" \
-d "$PGDATABASE" \
-v ON_ERROR_STOP=1 \
@ -198,10 +199,13 @@
>/dev/null
# ============================================================
# Application connection string
# SQLx / application connection string
#
# localhost is only the syntactic host. The host query
# parameter tells libpq/SQLx to use our Unix socket.
# ============================================================
export DATABASE_URL="postgresql://$PGUSER@/$PGDATABASE?host=$PGHOST"
export DATABASE_URL="postgresql://$PGUSER@localhost/$PGDATABASE?host=$PGHOST_ABS"
# ============================================================
# Development information
@ -217,14 +221,14 @@
echo
echo "PostgreSQL:"
echo " $(psql --version)"
echo " socket: $PGHOST"
echo " socket: $PGHOST_ABS"
echo " database: $PGDATABASE"
echo " user: $PGUSER"
echo
echo "PostGIS:"
psql \
-h "$PGHOST" \
-h "$PGHOST_ABS" \
-U "$PGUSER" \
-d "$PGDATABASE" \
-tAc "SELECT PostGIS_Full_Version();" |
@ -242,6 +246,7 @@
echo
echo "============================================================"
echo
set +e
'';
};
}