Skip to content

fix: clear TS_AUTHKEY env after config resolution#199

Merged
jtdowney merged 1 commit intomainfrom
fix/clear-ts-authkey-env
Apr 18, 2026
Merged

fix: clear TS_AUTHKEY env after config resolution#199
jtdowney merged 1 commit intomainfrom
fix/clear-ts-authkey-env

Conversation

@jtdowney
Copy link
Copy Markdown
Owner

The tsnet library independently reads TS_AUTHKEY from the process environment via getAuthKey(), even when tsbridge has determined that existing state should be used. This can cause control servers (particularly Headscale) to register a new node on each restart instead of reusing the existing one.

Clear TS_AUTHKEY and TS_AUTH_KEY from the environment after resolving them into the config struct. Cache the resolved Tailscale config in the Docker provider so subsequent Load() calls don't fail from the cleared env vars.

The tsnet library independently reads TS_AUTHKEY from the
process environment via getAuthKey(), even when tsbridge has
determined that existing state should be used. This can cause
control servers (particularly Headscale) to register a new
node on each restart instead of reusing the existing one.

Clear TS_AUTHKEY and TS_AUTH_KEY from the environment after
resolving them into the config struct. Cache the resolved
Tailscale config in the Docker provider so subsequent
Load() calls don't fail from the cleared env vars.
@jtdowney jtdowney merged commit aa6d1fc into main Apr 18, 2026
7 checks passed
@jtdowney jtdowney deleted the fix/clear-ts-authkey-env branch April 18, 2026 02:30
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