Skip to content

Commit

Permalink
Add support for running on an exposed port (#16)
Browse files Browse the repository at this point in the history
* Only tweak if using ingress

* Only change paths if using ingress
  • Loading branch information
lildude authored Apr 27, 2024
1 parent e002ff7 commit 0ce9525
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
3 changes: 3 additions & 0 deletions DOCS.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ The configuration is self-explanatory, but essentially we need details about acc

Remember to restart the add-on when the configuration is changed.

To use this add-on with a reverse proxy, like [Nginx Proxy Manager][rev-proxy], you will need to enable "Show disabled ports" in the Network section of the add-on configuration and set a port.

## Changelog & Releases

This repository keeps a change log using [GitHub's releases][releases] functionality.
Expand All @@ -56,3 +58,4 @@ To destroy this data, you'll need to either uninstall the PostgreSQL add-on or c
[postgres]: https://github.com/matt-FFFFFF/hassio-addon-postgres
[releases]: https://github.com/lildude/ha-addon-ghostfolio/releases
[semver]: https://semver.org/spec/v2.0.0.html
[rev-proxy]: https://github.com/hassio-addons/addon-nginx-proxy-manager
12 changes: 9 additions & 3 deletions rootfs/etc/services.d/ghostfolio/run
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,15 @@ ingress_entry=$(curl -X GET \
-s http://supervisor/addons/self/info | \
jq -r '.data.ingress_entry')

if [[ $(grep hassio_ingress /ghostfolio/apps/client/en/main.*.js) -eq 0 ]]; then
sed -Ei "s^(\`|\")/api^\1${ingress_entry}/api^g" /ghostfolio/apps/client/*/*.js
sed -Ei "s^\(/assets^\(${ingress_entry}/assets^g" /ghostfolio/apps/client/*/*.js
if bashio::var.is_empty "$(bashio::addon.port 3333)"; then
if [[ $(grep hassio_ingress /ghostfolio/apps/client/en/main.*.js) -eq 0 ]]; then
sed -Ei.direct "s^(\`|\")/api^\1${ingress_entry}/api^g" /ghostfolio/apps/client/*/*.js
sed -Ei.direct "s^\(/assets^\(${ingress_entry}/assets^g" /ghostfolio/apps/client/*/*.js
fi
else
if [[ $(find "/ghostfolio/apps/client/en/*.js.direct" 2> /dev/null | wc -l) -gt 0 ]]; then
find /ghostfolio/apps/ -name '*.direct' -exec sh -c 'echo "$0" "${0%.direct}"' {} \;
fi
fi

bashio::log.info "Starting Ghostfolio"
Expand Down

0 comments on commit 0ce9525

Please sign in to comment.