Skip to content

refactor(server): group env vars by subsystem; relay cap default 1GB - #87

Merged
polius merged 1 commit into
mainfrom
refactor/server-env-naming
Jun 25, 2026
Merged

polius merged 1 commit into
mainfrom
refactor/server-env-naming

Conversation

@polius

@polius polius commented Jun 25, 2026

Copy link
Copy Markdown
Owner

What

Renames the server's environment variables to a consistent
FSEND_<DOMAIN>_<ATTRIBUTE> scheme so related knobs group together and each
name says what it configures, and raises the per-session relay cap default
from 100MB to 1GB.

Renames

Old New
FSEND_UDP_ADDR FSEND_RELAY_ADDR
FSEND_ENABLE_RELAY FSEND_RELAY_ENABLED
FSEND_MAX_RELAY_BYTES_PER_SESSION FSEND_RELAY_MAX_BYTES_PER_SESSION
FSEND_HTTP_ADDR FSEND_PAIRING_ADDR
FSEND_MAX_SESSIONS_PER_IP FSEND_PAIRING_MAX_SESSIONS_PER_IP
FSEND_MAX_NEW_SESSIONS_PER_IP_PER_MIN FSEND_PAIRING_MAX_NEW_SESSIONS_PER_IP_PER_MIN

FSEND_LOG_LEVEL and FSEND_SERVER_PASSWORD stay unchanged — they're
server-wide, not subsystem-specific, and SERVER_PASSWORD must not be
confused with the client-side transfer password FSEND_PASS.

--help and the docs now list the vars grouped General / Pairing /
Relay
, with aligned columns.

Default change: relay cap 100MB → 1GB

100MB was too small to be a useful fallback: hole-punching fails most often
on large transfers, which is exactly when the relay is needed — a 100MB
cap fails the case the relay exists for. 1GB matches the value the compose
stack already ran and stays abuse-bounded (the per-IP session limits cap
concurrency). Applied to both the binary default and the relay package's
own Default(), so there's a single source of truth.

Compose cleanup

The shipped docker-compose.yml no longer restates defaults (that
duplication is what produced an earlier 1GB-vs-100MB doc bug). It now sets
only FSEND_DOMAIN and shows the one override most self-hosters want
(FSEND_SERVER_PASSWORD) as a comment, pointing to --help for the rest.

Breaking change

These are released env var names and there is no compatibility shim (by
decision). An existing deployment's old vars are silently ignored after
upgrade and fall back to defaults. The release notes will carry a banner;
nothing in-code warns. The biggest blast radius is FSEND_HTTP_ADDR
(config + the Docker --health-check path) — both updated here.

Tests

Pure-rename mechanical change plus the one default bump:

  • TestServerLoadConfigDefaults now asserts the 1GB default.
  • All server/relay/e2e env references updated to the new names.
  • Verified locally: go build, go vet, gofmt -l, full suite incl.
    -race and the e2e harness — all green.

Not in scope (deliberate, discussed)

Rate-limit defaults (5 / 30) stay as-is — they're the abuse bound, fine
for individuals, and a documented tunable for shared-NAT orgs. Bare-metal
:443 privilege and "set a password for a private server" are doc notes,
not value changes. info logging being near-silent is the upcoming
observability work, not a default.

🤖 Generated with Claude Code

@polius
polius force-pushed the refactor/server-env-naming branch 2 times, most recently from 4d4fce8 to a30d96c Compare June 25, 2026 16:00
…t to 1GB

Rename the server's environment variables to a consistent
FSEND_<DOMAIN>_<ATTRIBUTE> scheme so related knobs group together and each
name says what it configures:

  FSEND_UDP_ADDR                        -> FSEND_RELAY_ADDR
  FSEND_ENABLE_RELAY                    -> FSEND_RELAY_ENABLED
  FSEND_MAX_RELAY_BYTES_PER_SESSION     -> FSEND_RELAY_MAX_BYTES_PER_SESSION
  FSEND_HTTP_ADDR                       -> FSEND_PAIRING_ADDR
  FSEND_MAX_SESSIONS_PER_IP             -> FSEND_PAIRING_MAX_SESSIONS_PER_IP
  FSEND_MAX_NEW_SESSIONS_PER_IP_PER_MIN -> FSEND_PAIRING_MAX_NEW_SESSIONS_PER_IP_PER_MIN

FSEND_LOG_LEVEL and FSEND_SERVER_PASSWORD stay as-is: they're server-wide,
not subsystem-specific, and SERVER_PASSWORD must not be confused with the
client-side transfer password FSEND_PASS. --help and the docs now list the
vars grouped General / Pairing / Relay.

Also raise the per-session relay cap default from 100MB to 1GB. 100MB was
too small to be a useful fallback: hole-punching fails most often on large
transfers, which is exactly when the relay is needed. 1GB matches the value
the compose stack already ran and stays abuse-bounded (the per-IP session
limits cap concurrency). The shipped compose no longer restates defaults —
it now sets only FSEND_DOMAIN and shows the common overrides as comments.

This is a breaking change to released env var names (no compatibility
shim); the release notes will call it out.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@polius
polius force-pushed the refactor/server-env-naming branch from a30d96c to a79f1c3 Compare June 25, 2026 16:02
@polius
polius merged commit 3fefa69 into main Jun 25, 2026
20 checks passed
@polius
polius deleted the refactor/server-env-naming branch June 25, 2026 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant