Skip to content

feat: read bot-password credentials per wiki - #11

Merged
CameronBrooks11 merged 1 commit into
mainfrom
feat/per-wiki-credentials
Oct 22, 2026
Merged

CameronBrooks11 merged 1 commit into
mainfrom
feat/per-wiki-credentials

Conversation

@CameronBrooks11

Copy link
Copy Markdown
Member

What

push --apply and the live test read bot-password credentials per wiki:

  1. WIKISYNC_USERNAME_<WIKI> and WIKISYNC_PASSWORD_<WIKI>, where <WIKI> is
    the host's label before the top-level domain, uppercased, with anything else
    turned into _ (www.appropedia.org → APPROPEDIA);
  2. otherwise WIKISYNC_USERNAME and WIKISYNC_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 key
and uses the generic names, so CI needs no change. push --apply reports which
variable 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/creds tests: 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.
  • Breaking each rule separately (skipping the per-wiki pair, accepting half a
    pair, dropping the IP check) fails exactly the test for that rule.
  • CLI: push --apply --summary s with no credentials exits 2 before any login;
    the test clears the variables so the developer's shell can't change it.
  • just test-live with nothing set fails and names
    WIKISYNC_USERNAME_APPROPEDIA/WIKISYNC_PASSWORD_APPROPEDIA and the fallback.
  • go vet with and without the integration tag; the CI integration job runs
    against the throwaway wiki through the generic names.

Limitation: hosts under a two-part suffix such as example.co.uk derive the
wrong label. The README says to use the generic names for those.

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.
@CameronBrooks11
CameronBrooks11 merged commit 25bcf0e into main Oct 22, 2026
6 checks passed
@CameronBrooks11
CameronBrooks11 deleted the feat/per-wiki-credentials branch October 22, 2026 17:20
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