Skip to content

Fix config push when the gateway has no config directory - #51

Merged
sashyo merged 1 commit into
mainfrom
fix/config-push-missing-dir
Aug 13, 2026
Merged

sashyo merged 1 commit into
mainfrom
fix/config-push-missing-dir

Conversation

@sashyo

@sashyo sashyo commented Aug 13, 2026

Copy link
Copy Markdown
Owner

Second bug found while updating the live gateways, same area as #50.

The bug

A gateway configured purely by environment variables has no gateway.toml and no config directory. The path resolves under $HOME/.keylessh/, which doesn't exist, so the first config push failed with No such file or directory.

Not a corner case — it's how all three punchd-gateway container instances run. az container show reports volumes: null, with every setting (GATEWAY_ID, BACKENDS, API_SECRET, TIDECLOAK_CONFIG_B64, …) passed as an env var.

The fix

Create the parent directory before writing.

Testing

47 gateway tests pass, one new: writing to a path whose parent doesn't exist creates it, and the config reads back.

Related caveat, not fixed here

Because those containers mount no volumes, a pushed gateway.toml lives in the container's writable layer and is lost on restart, reverting to the env-var values. TOML takes precedence over env while the file exists, so pushes do work — they just aren't durable across a container recreate.

Making them durable means mounting a volume for the config directory, which is a deployment change rather than a code one. Worth deciding before relying on push for those gateways.

A gateway configured entirely by environment variables has no gateway.toml
and no config directory — which is exactly how the punchd-gateway container
instances run, with every setting passed as an env var and no volumes. The
first push resolved a path under a directory that did not exist and the
write failed with ENOENT.

Creates the parent directory before writing.
@sashyo
sashyo merged commit 8ce6f8d into main Aug 13, 2026
2 checks passed
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