Skip to content

Commit 62810e7

Browse files
authored
Support HTTP_PORT as Docker environment variable (#280)
1 parent cfc64e9 commit 62810e7

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -480,8 +480,9 @@ The use of environment variables allow you to provide over-rides to default sett
480480
|--------------------- | ----------- |
481481
| `PUID` | The User ID you wish the Apprise services under the hood to run as when the container starts as root and no explicit `--user` / `user:` has been set. The default is `1000` if not otherwise specified.
482482
| `PGID` | The Group ID used in the same scenario as `PUID`. If the container is started with an explicit `--user` or `user:`, that value takes precedence and `PUID` / `PGID` are not consulted for process privileges.
483-
| `IPV4_ONLY` | Force an all IPv4 only environment (default supports both IPV4 and IPv6). Nothing is done if `IPV6_ONLY` is also set as this creates an ambigious setup.
484-
| `IPV6_ONLY` | Force an all IPv6 only environment (default supports both IPv4 and IPv6). Nothing is done if `IPV4_ONLY` is also set as this creates an ambigious setup.
483+
| `IPV4_ONLY` | Force an all IPv4 only environment (default supports both IPV4 and IPv6). Nothing is done if `IPV6_ONLY` is also set as this creates an ambigious setup. **Note**: This only works if the container is not explicitly started with `--user` or `user:`.
484+
| `IPV6_ONLY` | Force an all IPv6 only environment (default supports both IPv4 and IPv6). Nothing is done if `IPV4_ONLY` is also set as this creates an ambigious setup. **Note**: This only works if the container is not explicitly started with `--user` or `user:`.
485+
| `HTTP_PORT` | Force the default listening port to be something other then `8000` within the Docker container. **Note**: This only works if the container is not explicitly started with `--user` or `user:`.
485486
| `APPRISE_DEFAULT_THEME` | Can be set to `light` or `dark`; it defaults to `light` if not otherwise provided. The theme can be toggled from within the website as well.
486487
| `APPRISE_DEFAULT_CONFIG_ID` | Defaults to `apprise`. This is the presumed configuration ID you always default to when accessing the configuration manager via the website.
487488
| `APPRISE_CONFIG_DIR` | Defines an (optional) persistent store location of all configuration files saved. By default:<br/> - Configuration is written to the `apprise_api/var/config` directory when just using the _Django_ `manage runserver` script. However for the path for the container is `/config`.

apprise_api/supervisord-startup

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,16 @@ chmod 1777 /tmp/apprise 2>/dev/null || true
8686
chown -R "$USER:$GROUP" /attach /config /config/store \
8787
/plugin /opt/apprise /tmp/apprise 2>/dev/null || true
8888

89+
if [ ! -z "${HTTP_PORT}" ]; then
90+
echo -n "Nginx/HTTP over-ride TCP/IP Listen Port: ${HTTP_PORT} ... "
91+
if [ -w /opt/apprise/webapp/etc/nginx.conf ]; then
92+
sed -i -e "s/^\([ \t]*listen[ \t]\+[^0-9]*\)\([^;]\+\);\(.*\)/\1${HTTP_PORT};\3/g" \
93+
/opt/apprise/webapp/etc/nginx.conf &>/dev/null && echo "Done." || echo "Failed!"
94+
else
95+
echo "Skipped (nginx.conf not writable)."
96+
fi
97+
fi
98+
8999
if [ "${IPV4_ONLY+x}" ] && [ "${IPV6_ONLY+x}" ]; then
90100
echo "ERROR: Both IPV4_ONLY and IPV6_ONLY are set. Exiting."
91101
exit 1
@@ -117,6 +127,12 @@ fi
117127
echo "Resolution of 'localhost' inside container:"
118128
getent ahosts localhost || true
119129

130+
# Get our Port Information
131+
PORT=$(grep -m1 -E '^[ \t]*listen[ \t]+' /opt/apprise/webapp/etc/nginx.conf 2>/dev/null | \
132+
sed -e 's/^[^0-9]\+\([0-9]\+\).*/\1/g')
133+
PORT=${PORT:=Unknown}
134+
135+
echo "Listening on TCP/IP Port: ${PORT}"
120136
# Working directory
121137
cd /opt/apprise
122138

0 commit comments

Comments
 (0)