diff --git a/4.4/docker-entrypoint.sh b/4.4/docker-entrypoint.sh index 9246798..4f50c3f 100755 --- a/4.4/docker-entrypoint.sh +++ b/4.4/docker-entrypoint.sh @@ -2,8 +2,13 @@ set -euo pipefail +: "${RT_ROOT_PASSWORD:=}" : "${RT_WEB_PORT:=80}" sed -i "s/RT_WEB_PORT/$RT_WEB_PORT/" /opt/rt4/etc/RT_SiteConfig.pm +if [[ -n "${RT_ROOT_PASSWORD}" ]]; then + (echo "${RT_ROOT_PASSWORD}" | /opt/rt4/sbin/rt-passwd root) || [[ $? -gt 1 ]] && exit 1 +fi + exec "$@" diff --git a/5.0/docker-entrypoint.sh b/5.0/docker-entrypoint.sh index d438c36..6f76861 100755 --- a/5.0/docker-entrypoint.sh +++ b/5.0/docker-entrypoint.sh @@ -2,8 +2,13 @@ set -euo pipefail +: "${RT_ROOT_PASSWORD:=}" : "${RT_WEB_PORT:=80}" sed -i "s/RT_WEB_PORT/$RT_WEB_PORT/" /opt/rt5/etc/RT_SiteConfig.pm +if [[ -n "${RT_ROOT_PASSWORD}" ]]; then + (echo "${RT_ROOT_PASSWORD}" | /opt/rt5/sbin/rt-passwd root) || [[ $? -gt 1 ]] && exit 1 +fi + exec "$@" diff --git a/README.md b/README.md index 5367187..b2eb441 100644 --- a/README.md +++ b/README.md @@ -78,6 +78,13 @@ docker run -d --name rt -p 8080:8080 -e RT_WEB_PORT=8080 ghcr.io/netsandbox/requ Then, access it via `http://localhost:8080` or `http://host-ip:8080` in a browser. +### Environment Variables + +| Environment Variable | Description | +| --- | --- | +| `RT_ROOT_PASSWORD` | RT root user password | +| `RT_WEB_PORT` | RT [WebPort](https://docs.bestpractical.com/rt/latest/RT_Config.html#WebPort) | + ## RT Extension Testing You can use these Docker images to test your RT Extensions. diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 1b585a6..0b54bcc 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -2,8 +2,13 @@ set -euo pipefail +: "${RT_ROOT_PASSWORD:=}" : "${RT_WEB_PORT:=80}" sed -i "s/RT_WEB_PORT/$RT_WEB_PORT/" /opt/rt%%RT_VERSION_MAJOR%%/etc/RT_SiteConfig.pm +if [[ -n "${RT_ROOT_PASSWORD}" ]]; then + (echo "${RT_ROOT_PASSWORD}" | /opt/rt%%RT_VERSION_MAJOR%%/sbin/rt-passwd root) || [[ $? -gt 1 ]] && exit 1 +fi + exec "$@"