Repository navigation
fix(p/DNSMADEEASY): ask the sandbox setting as a yes/no question in init - #4877
Merged
Merged
Conversation
TomOnTime
pushed a commit
that referenced
this pull request
Sep 13, 2026
…ue for yes/no fields (#4875) This is the first of five pull requests for #4381, where patschi found the `sandbox` question in `dnscontrol init` for INWX confusing (#4293 (comment)). This one contains the shared `init` changes. The provider specific prompts follow in four separate pull requests on top of this branch (INWX, DNSMADEEASY, FORTIGATE and CNR) #4876, #4877, #4878 and #4879, so each maintainer can review the part for their own provider. The first commit fixes the "(optional)" suffix that was shown twice. `askField()` already appends "(required)" or "(optional)" to every label, but 18 labels in 11 providers (AUTODNS, CLOUDFLAREAPI, CNR, DNSIMPLE, DNSMADEEASY, FORTIGATE, HEDNS, INWX, NAMECHEAP, PORKBUN and ROUTE53) also had it in the label text itself. The suffix is removed from those labels, and the label construction moved into `fieldLabel()`, which strips a trailing "(optional)" or "(required)" from the label so it cannot come back. `writing-providers.md` now mentions that the wizard adds the `creds.json` key and the suffix itself. Before, the INWX credential prompts on `main`: ```text API settings for INWX: https://www.inwx.com/en/customer ? Username (required) demo ? Password (required) [? for help] ****** ? Use sandbox (optional) [sandbox] (optional) 1 ``` After, on this branch: ```text API settings for INWX: https://www.inwx.com/en/customer ? Username (required) demo ? Password (required) [? for help] ****** ? Use sandbox [sandbox] (optional) 1 ``` The second commit adds `ConfirmValue` to `CredsField`. A few settings are really on or off, but `init` asks for them as free text with a value that is only explained after typing `?`: `1` for INWX, any non-empty value for DNS Made Easy and `true` for FortiGate. A field with `ConfirmValue` is asked as a yes/no question instead. Yes writes `ConfirmValue` to `creds.json` and no leaves the key out, so the resulting `creds.json` stays the same as with the free text answer. The field help is now passed to `Asker.Confirm()` so `?` keeps working, and the "(optional)" suffix is left out for these prompts because a yes/no answer is never empty. Nothing uses `ConfirmValue` in this pull request yet; the provider pull requests do. `go test ./commands/ ./pkg/providers/...` passes, including new tests for `fieldLabel()` and for `askField()` and `collectFields()` with `ConfirmValue`, and so does `go test` over the 11 touched provider packages. The before and after output comes from running the INWX credential prompts (`collectFields()` with the real survey prompts) in a pseudo terminal, on `main` and on this branch. ## AI-attributie Assisted-by: Claude Code:claude-opus-5
- Replace the free text `sandbox` prompt, which only explained in the `?` help that any non-empty value enables the sandbox, with a yes/no question using `ConfirmValue`. - Answering yes writes `"sandbox": "1"` to `creds.json`; the provider treats any non-empty value as sandbox, so the result matches existing configurations. Refs DNSControl#4381
cafferata
force-pushed
the
fix/init-dnsmadeeasy-prompt
branch
from
September 13, 2026 19:45
3b08aae to
7d4d262
Compare
TomOnTime
approved these changes
Sep 13, 2026
vojtad
approved these changes
Sep 13, 2026
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.
While looking into #4381 (the INWX sandbox question in
dnscontrol initbeing confusing), DNS Made Easy turned out to have the same kind of prompt. The question asks "Use sandbox", and only the?help explains that any non-empty value enables the sandbox. Because the provider checks for a non-empty value, answeringnoorfalseactually enables the sandbox API.The sandbox setting is now a yes/no question with production as the default. Answering yes writes
"sandbox": "1", which the provider already treats as sandbox, so existing configurations keep working.Before, after typing
?at the sandbox prompt:After, after typing
?at the sandbox prompt:Answering
ygives the following, and thecreds.jsonentry is identical to answering1before:The output above comes from running the DNS Made Easy credential prompts (
collectFields()with the real survey prompts) in a pseudo terminal, onmainand on this branch.go test ./providers/dnsmadeeasy/ ./commands/passes.@vojtad, as the DNS Made Easy maintainer, could you take a look?
Part of #4381
AI-attributie
Assisted-by: Claude Code:claude-opus-5