fix: default init URL to the encapi FQDN the cert covers
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
@@ -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()))
|
||||
|
||||
Reference in New Issue
Block a user