Skip to content

Commit

Permalink
build: listen_addresses to * if POSTGRES_LISTEN_ALL
Browse files Browse the repository at this point in the history
  • Loading branch information
tazlin committed Jun 23, 2024
1 parent 41283ae commit d2f4b14
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ai-horde/postgres/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
# Add pg_cron extension to the database
RUN echo "shared_preload_libraries = 'pg_cron'" >> /usr/share/postgresql/postgresql.conf.sample

CMD ["postgres"]
COPY ./horde_init.sh /docker-entrypoint-initdb.d/horde_init.sh
11 changes: 11 additions & 0 deletions ai-horde/postgres/horde_init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

# Set postgres 15's config option `listen_addresses = '*'` if the environment variable "POSTGRES_LISTEN_ALL" is set

if [ -z "$POSTGRES_LISTEN_ALL" ]; then
echo "POSTGRES_LISTEN_ALL is not set. Skipping..."
exit 0
fi

echo "Setting listen_addresses = '*' in /etc/postgresql/15/main/postgresql.conf"
sed -i "s/#listen_addresses = 'localhost'/listen_addresses = '*'/g" /etc/postgresql/15/main/postgresql.conf

0 comments on commit d2f4b14

Please sign in to comment.