Files
jcoffey-dev 6787289bb9 install: run again, it keeps the options it isn't given (#84)
Running install on a machine with an install recorded started from the
defaults, so an option left out changed the install: a missing --server
host asked for a move, a missing --proxy snippets swapped in Caddy, and
renaming meant repeating every option from the first run.

Now every option not on the command line or in --answers is taken from
the install: shapes (a component it doesn't have stays skipped), proxy,
names, dir, ACME contact and CA. The record gains the proxy, the front
ends' names and the ACME settings; for installs from before it, the proxy
is read from the deployment's files and the front ends' names from the
addresses the server is given (INBUXA_ADMIN_URL / INBUXA_WEBMAIL_URL).
The plan lists what it took. Front ends joined to a server elsewhere
inherit nothing.
2026-11-18 09:30:20 -07:00

21 lines
794 B
Go

// SPDX-FileCopyrightText: 2026 Coffey Labs LLC
// SPDX-License-Identifier: AGPL-3.0-or-later
package discover
import "testing"
func TestFrontEndHosts(t *testing.T) {
compose := "services:\n server:\n environment:\n INBUXA_ADMIN_URL: https://admin.example.com\n INBUXA_WEBMAIL_URL: https://webmail.example.com\n"
if c, w := FrontEndHosts(compose); c != "admin.example.com" || w != "webmail.example.com" {
t.Fatalf("compose: %q %q", c, w)
}
env := "INBUXA_ADMIN_URL=\"https://console.example.org\"\nINBUXA_WEBMAIL_URL=\n"
if c, w := FrontEndHosts(env); c != "console.example.org" || w != "" {
t.Fatalf("server.env: %q %q", c, w)
}
if c, _ := FrontEndHosts("INBUXA_ADMIN_URL=http://127.0.0.1:8082\n"); c != "" {
t.Fatalf("a loopback bind is not a name: %q", c)
}
}