fix(linting): give _IP variables a valid address placeholder - #84
Merged
Conversation
create_temp_env synthesises placeholder values from the variable name so
that docker compose config can run without real secrets. No arm produced a
valid IP address, so a name like TAILSCALE_IP fell through to the catch-all
and became "placeholder_value". That is harmless where the value is only an
environment string, but it fails validation outright when the variable is
used as a bind address:
ports:
- "${TAILSCALE_IP}:8191:8191" -> invalid IP address: placeholder_value
Add an arm yielding 127.0.0.1. It is placed before *URL*|*HOST* so that
names like NETWORK_OPTIMIZER_HOST_IP resolve to an address rather than a
URL, and is anchored to the _IP suffix because a bare *IP* glob would also
match unrelated names such as RECIPIENT_EMAIL.
Verified with shellcheck, and by regenerating placeholders for all 14
docker-piwine stacks and running docker compose config against each: all
pass, including network-optimizer, whose placeholder this reorders.
Reviewer's guide (collapsed on small PRs)Reviewer's GuideUpdates temporary environment generation so IP address variables receive Flow diagram for temporary IP placeholder selectionflowchart TD
A[create_temp_env receives variable name] --> B{Matches *_IP, *_IP_ADDRESS, or IP?}
B -->|Yes| C[Write 127.0.0.1 to temp env file]
B -->|No| D{Matches *URL* or *HOST*?}
D -->|Yes| E[Write http://localhost:8080 to temp env file]
D -->|No| F[Apply existing placeholder rules]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
Problem
create_temp_envsynthesises placeholder values from the variable name sodocker compose configcan run without real secrets. No arm produced a valid IP address, so a name likeTAILSCALE_IPfell through to the catch-all and becameplaceholder_value.That is harmless where the value is only an environment string — which is why
NETWORK_OPTIMIZER_HOST_IPhas never tripped it — but it fails validation outright the moment such a variable is used as a bind address:This is currently blocking owine/docker-piwine#1190.
Change
Add an arm yielding
127.0.0.1:Two deliberate details:
*URL*|*HOST*so names likeNETWORK_OPTIMIZER_HOST_IPresolve to an address instead ofhttp://localhost:8080. Without this ordering the*HOST*glob wins._IPsuffix. A bare*IP*glob would also match unrelated names —RECIPIENT_EMAILcontainsIP.Verification
shellcheckclean.docker-piwinestacks and randocker compose configagainst each — all pass, includingnetwork-optimizer, whose placeholder this reorders.host_ip: 127.0.0.1instead of failing.Summary by Sourcery
Generate valid IP address placeholders for linting environment variables.
Bug Fixes:
_IPor_IP_ADDRESS, allowing Docker Compose validation of bind-address configurations.Enhancements: