Add smart Caddy auto-configuration

This commit is contained in:
Azat
2026-02-02 22:20:36 +01:00
parent 373fef6f1b
commit d88b2104a2
2 changed files with 60 additions and 1 deletions

View File

@@ -29,6 +29,7 @@ Installs [ttyd](https://github.com/tsl0922/ttyd) - a simple command-line tool fo
| `TTYD_COMMAND` | Command to run | `/bin/bash` |
| `TTYD_CREDENTIAL` | Basic auth (user:pass) | (none) |
| `TTYD_OPTIONS` | Additional ttyd options | (none) |
| `TTYD_DOMAIN` | Domain for Caddy auto-config | (none) |
## Usage
@@ -54,7 +55,20 @@ TTYD_CREDENTIAL="admin:secret" ./scripts/run.sh
TTYD_COMMAND="htop" ./scripts/run.sh
```
### With Caddy (HTTPS)
### Auto-configuration with Caddy
If the `caddy` skill is present, ttyd will automatically register itself:
```bash
# Set domain for auto-config
TTYD_DOMAIN="terminal.example.com"
```
This creates a snippet in `caddy/snippets.d/ttyd.caddy` that Caddy imports on startup.
### Manual Caddy Config
If not using auto-config:
```caddyfile
terminal.example.com {