feat: add configurable HTTPS port
All checks were successful
renovate / renovate (push) Successful in 19s
Docker Build and Push / build-and-push (push) Successful in 1m24s

This commit is contained in:
2025-12-28 20:03:49 +07:00
parent c3a469be64
commit bf7f7bd8da
3 changed files with 4 additions and 2 deletions

View File

@@ -40,7 +40,7 @@ USER appuser
ENV TZ=Asia/Jakarta ENV TZ=Asia/Jakarta
EXPOSE 2200 80 443 EXPOSE 2200 80 8443
LABEL org.opencontainers.image.title="Tunnel Please" \ LABEL org.opencontainers.image.title="Tunnel Please" \
org.opencontainers.image.description="SSH-based tunnel server" org.opencontainers.image.description="SSH-based tunnel server"

View File

@@ -22,6 +22,7 @@ The following environment variables can be configured in the `.env` file:
|----------|-------------|---------|----------| |----------|-------------|---------|----------|
| `DOMAIN` | Domain name for subdomain routing | `localhost` | No | | `DOMAIN` | Domain name for subdomain routing | `localhost` | No |
| `PORT` | SSH server port | `2200` | No | | `PORT` | SSH server port | `2200` | No |
| `HTTPS_PORT` | HTTPS server port | `8443` | No |
| `TLS_ENABLED` | Enable TLS/HTTPS | `false` | No | | `TLS_ENABLED` | Enable TLS/HTTPS | `false` | No |
| `TLS_REDIRECT` | Redirect HTTP to HTTPS | `false` | No | | `TLS_REDIRECT` | Redirect HTTP to HTTPS | `false` | No |
| `ACME_EMAIL` | Email for Let's Encrypt registration | `admin@<DOMAIN>` | No | | `ACME_EMAIL` | Email for Let's Encrypt registration | `admin@<DOMAIN>` | No |

View File

@@ -14,13 +14,14 @@ import (
func NewHTTPSServer() error { func NewHTTPSServer() error {
domain := utils.Getenv("DOMAIN", "localhost") domain := utils.Getenv("DOMAIN", "localhost")
httpsPort := utils.Getenv("HTTPS_PORT", "8443")
tlsConfig, err := NewTLSConfig(domain) tlsConfig, err := NewTLSConfig(domain)
if err != nil { if err != nil {
return fmt.Errorf("failed to initialize TLS config: %w", err) return fmt.Errorf("failed to initialize TLS config: %w", err)
} }
ln, err := tls.Listen("tcp", ":443", tlsConfig) ln, err := tls.Listen("tcp", ":"+httpsPort, tlsConfig)
if err != nil { if err != nil {
return err return err
} }