Skip to content

Commit

Permalink
add support for CanonicalizeRedirectURLs and WebDomain
Browse files Browse the repository at this point in the history
resolves #23
  • Loading branch information
netsandbox committed Feb 11, 2024
1 parent d7e0ead commit 56e731d
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 9 deletions.
4 changes: 3 additions & 1 deletion 4.4/RT_SiteConfig.pm
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
use utf8;

Set($WebPort, RT_WEB_PORT);
Set($CanonicalizeRedirectURLs, RT_CANONICALIZE_REDIRECT_URLS);
Set($MailCommand, "testfile");
Set($WebDomain, "RT_WEB_DOMAIN");
Set($WebPort, RT_WEB_PORT);

1;
11 changes: 9 additions & 2 deletions 4.4/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,17 @@

set -euo pipefail

: "${RT_ROOT_PASSWORD:=}"
: "${RT_CANONICALIZE_REDIRECT_URLS:=0}"
: "${RT_WEB_DOMAIN:=localhost}"
: "${RT_WEB_PORT:=80}"

sed -i "s/RT_WEB_PORT/$RT_WEB_PORT/" /opt/rt4/etc/RT_SiteConfig.pm
: "${RT_ROOT_PASSWORD:=}"

sed -i \
-e "s/RT_CANONICALIZE_REDIRECT_URLS/$RT_CANONICALIZE_REDIRECT_URLS/" \
-e "s/RT_WEB_DOMAIN/$RT_WEB_DOMAIN/" \
-e "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
Expand Down
4 changes: 3 additions & 1 deletion 5.0/RT_SiteConfig.pm
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
use utf8;

Set($WebPort, RT_WEB_PORT);
Set($CanonicalizeRedirectURLs, RT_CANONICALIZE_REDIRECT_URLS);
Set($MailCommand, "testfile");
Set($WebDomain, "RT_WEB_DOMAIN");
Set($WebPort, RT_WEB_PORT);

1;
11 changes: 9 additions & 2 deletions 5.0/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,17 @@

set -euo pipefail

: "${RT_ROOT_PASSWORD:=}"
: "${RT_CANONICALIZE_REDIRECT_URLS:=0}"
: "${RT_WEB_DOMAIN:=localhost}"
: "${RT_WEB_PORT:=80}"

sed -i "s/RT_WEB_PORT/$RT_WEB_PORT/" /opt/rt5/etc/RT_SiteConfig.pm
: "${RT_ROOT_PASSWORD:=}"

sed -i \
-e "s/RT_CANONICALIZE_REDIRECT_URLS/$RT_CANONICALIZE_REDIRECT_URLS/" \
-e "s/RT_WEB_DOMAIN/$RT_WEB_DOMAIN/" \
-e "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
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ Then, access it via `http://localhost:8080` or `http://host-ip:8080` in a browse

| Environment Variable | Description |
| --- | --- |
| `RT_CANONICALIZE_REDIRECT_URLS` | RT [CanonicalizeRedirectURLs](https://docs.bestpractical.com/rt/latest/RT_Config.html#CanonicalizeRedirectURLs) |
| `RT_ROOT_PASSWORD` | RT root user password |
| `RT_WEB_DOMAIN` | RT [WebDomain](https://docs.bestpractical.com/rt/latest/RT_Config.html#WebDomain) |
| `RT_WEB_PORT` | RT [WebPort](https://docs.bestpractical.com/rt/latest/RT_Config.html#WebPort) |

## RT Extension Testing
Expand Down
4 changes: 3 additions & 1 deletion RT_SiteConfig.pm
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
use utf8;

Set($WebPort, RT_WEB_PORT);
Set($CanonicalizeRedirectURLs, RT_CANONICALIZE_REDIRECT_URLS);
Set($MailCommand, "testfile");
Set($WebDomain, "RT_WEB_DOMAIN");
Set($WebPort, RT_WEB_PORT);

1;
11 changes: 9 additions & 2 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,17 @@

set -euo pipefail

: "${RT_ROOT_PASSWORD:=}"
: "${RT_CANONICALIZE_REDIRECT_URLS:=0}"
: "${RT_WEB_DOMAIN:=localhost}"
: "${RT_WEB_PORT:=80}"

sed -i "s/RT_WEB_PORT/$RT_WEB_PORT/" /opt/rt%%RT_VERSION_MAJOR%%/etc/RT_SiteConfig.pm
: "${RT_ROOT_PASSWORD:=}"

sed -i \
-e "s/RT_CANONICALIZE_REDIRECT_URLS/$RT_CANONICALIZE_REDIRECT_URLS/" \
-e "s/RT_WEB_DOMAIN/$RT_WEB_DOMAIN/" \
-e "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
Expand Down

0 comments on commit 56e731d

Please sign in to comment.