fix: default init URL to the encapi FQDN the cert covers
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/build Pipeline was successful

This commit is contained in:
2026-11-08 17:34:55 +11:00
parent 9a36da3174
commit 612874a0c7
3 changed files with 6 additions and 5 deletions
+3 -2
View File
@@ -40,8 +40,9 @@ The encapi base URL comes from the first of:
5. the compiled-in default `http://encapi.encapi.svc.cluster.local`.
Conf files are shell-sourceable `KEY=VALUE` (`ENCAPI_URL=https://...`).
`encapic init` prompts for the URL, writes the user conf and offers to install
shell completion. With no config found, an interactive run prints a hint to
`encapic init` prompts for the URL (default
`https://encapi.k8s.syd1.au.unkin.net`), writes the user conf and offers to
install shell completion. With no config found, an interactive run prints a hint to
stderr; non-TTY runs (the puppet exec ENC) stay silent.
### Shell completion
+1 -1
View File
@@ -11,7 +11,7 @@ import (
"strings"
)
const initDefaultURL = "https://encapi"
const initDefaultURL = "https://encapi.k8s.syd1.au.unkin.net"
// systemConfPaths follow the user conf in precedence; the legacy path is a
// read-only fallback for hosts whose puppet still manages it.
+2 -2
View File
@@ -71,7 +71,7 @@ func TestInitConfig(t *testing.T) {
name, input, want string
wantErr bool
}{
{"default", "\nn\n", "ENCAPI_URL=https://encapi\n", false},
{"default", "\nn\n", "ENCAPI_URL=https://encapi.k8s.syd1.au.unkin.net\n", false},
{"custom", "http://encapi.example:8080\nn\n", "ENCAPI_URL=http://encapi.example:8080\n", false},
{"invalid", "ftp://nope\n", "", true},
{"no host", "encapi.example\n", "", true},
@@ -94,7 +94,7 @@ func TestInitConfig(t *testing.T) {
if string(b) != tc.want {
t.Errorf("conf = %q, want %q", b, tc.want)
}
if !strings.Contains(out.String(), "encapi URL [https://encapi]: ") {
if !strings.Contains(out.String(), "encapi URL [https://encapi.k8s.syd1.au.unkin.net]: ") {
t.Errorf("missing URL prompt in %q", out.String())
}
fi, err := os.Stat(filepath.Dir(userConfPath()))