Repository navigation
feat: read bot-password credentials per wiki - #11
Merged
Merged
Conversation
push --apply and the live test now look for WIKISYNC_USERNAME_<WIKI> and WIKISYNC_PASSWORD_<WIKI>, where <WIKI> is the host's label before the top-level domain, uppercased (www.appropedia.org -> APPROPEDIA), and fall back to WIKISYNC_USERNAME / WIKISYNC_PASSWORD. A pair is only used when both halves are set, so the two sources are never mixed. An IP host has no per-wiki key. push --apply reports which variable it logged in from. This lets several wikis be configured side by side, and the live test can take credentials named for the wiki without remapping them on the command line.
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.
What
push --applyand the live test read bot-password credentials per wiki:WIKISYNC_USERNAME_<WIKI>andWIKISYNC_PASSWORD_<WIKI>, where<WIKI>isthe host's label before the top-level domain, uppercased, with anything else
turned into
_(www.appropedia.org→APPROPEDIA);WIKISYNC_USERNAMEandWIKISYNC_PASSWORD.A pair is used only when both halves are set, so the two sources are never
mixed. An IP host (like the CI test wiki,
127.0.0.1:8080) has no per-wiki keyand uses the generic names, so CI needs no change.
push --applyreports whichvariable it logged in from (the username only, never the password).
This lets several wikis be configured side by side. It also lets the Appropedia
smoke run take credentials named for the wiki directly, with no remapping on the
command line.
Verification
internal/credstests: key derivation (subdomain, bare domain, trailing dot,case, hyphen, port, IPv4/IPv6, localhost), per-wiki preferred, generic
fallback, never mixing halves, IP host, nothing set.
pair, dropping the IP check) fails exactly the test for that rule.
push --apply --summary swith no credentials exits 2 before any login;the test clears the variables so the developer's shell can't change it.
just test-livewith nothing set fails and namesWIKISYNC_USERNAME_APPROPEDIA/WIKISYNC_PASSWORD_APPROPEDIAand the fallback.go vetwith and without theintegrationtag; the CI integration job runsagainst the throwaway wiki through the generic names.
Limitation: hosts under a two-part suffix such as
example.co.ukderive thewrong label. The README says to use the generic names for those.