Skip to content

Commit

Permalink
Switch to include, document watchlist functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
thespad committed Jan 19, 2025
1 parent 02ed03a commit 21b5a79
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ services:
- STAGING=false #optional
- DISABLE_F2B= #optional
- SWAG_AUTORELOAD= #optional
- SWAG_AUTORELOAD_WATCHLIST= #optional
volumes:
- /path/to/swag/config:/config
ports:
Expand Down Expand Up @@ -220,6 +221,7 @@ docker run -d \
-e STAGING=false `#optional` \
-e DISABLE_F2B= `#optional` \
-e SWAG_AUTORELOAD= `#optional` \
-e SWAG_AUTORELOAD_WATCHLIST= `#optional` \
-p 443:443 \
-p 80:80 `#optional` \
-v /path/to/swag/config:/config \
Expand Down Expand Up @@ -249,7 +251,8 @@ Containers are configured using parameters passed at runtime (such as those abov
| `-e EXTRA_DOMAINS=` | Additional fully qualified domain names (comma separated, no spaces) ie. `example.net,subdomain.example.net,*.example.org` |
| `-e STAGING=false` | Set to `true` to retrieve certs in staging mode. Rate limits will be much higher, but the resulting cert will not pass the browser's security test. Only to be used for testing purposes. |
| `-e DISABLE_F2B=` | Set to `true` to disable the Fail2ban service in the container, if you're already running it elsewhere or using a different IPS. |
| `-e SWAG_AUTORELOAD=` | Set to `true` to enable automatic reloading of nginx configs on change. Your filesystem must support inotify. This functionality was previous offered [via mod](https://github.com/linuxserver/docker-mods/tree/swag-auto-reload). |
| `-e SWAG_AUTORELOAD=` | Set to `true` to enable automatic reloading of nginx confs on change. Your filesystem must support inotify. This functionality was previous offered [via mod](https://github.com/linuxserver/docker-mods/tree/swag-auto-reload). |
| `-e SWAG_AUTORELOAD_WATCHLIST=` | A `|`-separated list of additional folders for auto reload to watch in addition to `/config/nginx` |
| `-v /config` | Persistent config files |
| `--read-only=true` | Run container with a read-only filesystem. Please [read the docs](https://docs.linuxserver.io/misc/read-only/). |
| `--cap-add=NET_ADMIN` | Required for fail2Ban to be able to modify iptables rules. |
Expand Down
3 changes: 2 additions & 1 deletion readme-vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ opt_param_env_vars:
- {env_var: "EXTRA_DOMAINS", env_value: "", desc: "Additional fully qualified domain names (comma separated, no spaces) ie. `example.net,subdomain.example.net,*.example.org`"}
- {env_var: "STAGING", env_value: "false", desc: "Set to `true` to retrieve certs in staging mode. Rate limits will be much higher, but the resulting cert will not pass the browser's security test. Only to be used for testing purposes."}
- {env_var: "DISABLE_F2B", env_value: "", desc: "Set to `true` to disable the Fail2ban service in the container, if you're already running it elsewhere or using a different IPS."}
- {env_var: "SWAG_AUTORELOAD", env_value: "", desc: "Set to `true` to enable automatic reloading of nginx configs on change. Your filesystem must support inotify. This functionality was previous offered [via mod](https://github.com/linuxserver/docker-mods/tree/swag-auto-reload)."}
- {env_var: "SWAG_AUTORELOAD", env_value: "", desc: "Set to `true` to enable automatic reloading of nginx confs on change. Your filesystem must support inotify. This functionality was previous offered [via mod](https://github.com/linuxserver/docker-mods/tree/swag-auto-reload)."}
- {env_var: "SWAG_AUTORELOAD_WATCHLIST", env_value: "", desc: "A `|`-separated list of additional folders for auto reload to watch in addition to `/config/nginx`"}
opt_param_usage_include_ports: true
opt_param_ports:
- {external_port: "80", internal_port: "80", port_desc: "HTTP port (required for HTTP validation and HTTP -> HTTPS redirect)"}
Expand Down
4 changes: 2 additions & 2 deletions root/etc/s6-overlay/s6-rc.d/svc-swag-auto-reload/run
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ if [[ ${SWAG_AUTORELOAD,,} == "true" ]]; then
echo "Auto-reload: Watching the following files/folders for changes (excluding .sample, .swp, and .md files):"
echo "/config/nginx"
ACTIVE_WATCH=("/config/nginx")
for i in $(echo "${WATCHLIST}" | tr "|" " "); do
for i in $(echo "${SWAG_AUTORELOAD_WATCHLIST}" | tr "|" " "); do
if [ -f "${i}" ] || [ -d "${i}" ]; then
echo "${i}"
ACTIVE_WATCH+=("${i}")
Expand All @@ -19,7 +19,7 @@ if [[ ${SWAG_AUTORELOAD,,} == "true" ]]; then
function wait_for_changes {
inotifywait -rq \
--event modify,move,create,delete \
--excludei '\.(sample|md|swp)' \
--include '\.(conf)' \
"${ACTIVE_WATCH[@]}"
}

Expand Down

0 comments on commit 21b5a79

Please sign in to comment.