fix: read Caddy's X-Api-Key from IGNIS_API_KEY instead of hardcoding it#11
Merged
Conversation
The key was hardcoded directly in the committed Caddyfile. Nothing in CI or elsewhere actually depends on that literal value (checked — no references outside the Caddyfile itself), so there was no reason it couldn't be an env var like ALLOWED_ORIGINS already is. Default value in docker.env is unchanged (supersecret123), so local dev behaves identically; a real deployment now only needs to override docker.env, not edit source. Verified live: rebuilt and ran the full ignis-db/ignis-app/ignis-reverse-proxy stack, confirmed 403 with no/wrong key and 200 with the configured key.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
X-Api-Keyvalue was hardcoded directly in the committedCaddyfile("supersecret123"). Nothing in CI or elsewhere depends on that literal value — checked, no references outside the Caddyfile itself — so there was no reason it couldn't be an env var, same asALLOWED_ORIGINSalready is.IGNIS_API_KEY(seedocker.env) at container start. Default value is unchanged, so local dev behaves identically; a real deployment now only needs to overridedocker.envinstead of editing source.Test plan
caddy validateagainst the updatedCaddyfileignis-db/ignis-app/ignis-reverse-proxystack locally403with no API key and with a wrong key,200with the configured key