build - prozess optimiert mit push nach zot
nginx-kill - > maint. site...
This commit is contained in:
1 parent
665135f87e
commit
64417d8353
19 files changed
+447
-61
No files matched your search
+10
-3
@@ -50,7 +50,7 @@ func Run(ctx context.Context, args []string, stdout, stderr io.Writer) int {
|
||||
fmt.Fprint(stdout, usage)
|
||||
return 0
|
||||
case "version":
|
||||
fmt.Fprintf(stdout, "sultan %s\n", Version)
|
||||
fmt.Fprintf(stdout, "sultan %s\nZeitzone: %s\n", Version, time.Local)
|
||||
return 0
|
||||
case "server":
|
||||
return runServer(ctx, args[1:], stdout, stderr)
|
||||
@@ -127,5 +127,12 @@ func parseServerFlags(args []string, output io.Writer, getenv func(string) strin
|
||||
// stringList ist ein mehrfach angebbares String-Flag.
|
||||
type stringList []string
|
||||
|
||||
func (l *stringList) String() string { return strings.Join(*l, ",") }
|
||||
func (l *stringList) Set(v string) error { *l = append(*l, v); return nil }
|
||||
func (l *stringList) String() string { return strings.Join(*l, ",") }
|
||||
|
||||
// Set ignoriert leere Werte (z. B. eine leere Variable in Compose).
|
||||
func (l *stringList) Set(v string) error {
|
||||
if v = strings.TrimSpace(v); v != "" {
|
||||
*l = append(*l, v)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
+18
-1
@@ -33,9 +33,14 @@ func TestRun_Usage(t *testing.T) {
|
||||
|
||||
func TestRun_Version(t *testing.T) {
|
||||
code, stdout, _ := run(context.Background(), "version")
|
||||
if code != 0 || strings.TrimSpace(stdout) != "sultan "+Version {
|
||||
lines := strings.Split(strings.TrimSpace(stdout), "\n")
|
||||
if code != 0 || lines[0] != "sultan "+Version {
|
||||
t.Errorf("version: code=%d stdout=%q", code, stdout)
|
||||
}
|
||||
// Die aktive Zeitzone sichtbar machen (Distroless-Images ohne tzdata fallen still auf UTC).
|
||||
if len(lines) < 2 || lines[1] != "Zeitzone: "+time.Local.String() {
|
||||
t.Errorf("Zeitzone fehlt: %q", stdout)
|
||||
}
|
||||
}
|
||||
|
||||
func TestServerFlags(t *testing.T) {
|
||||
@@ -219,3 +224,15 @@ func TestServerFlags_EnrollLimit(t *testing.T) {
|
||||
t.Errorf("--enroll-limit=-1: %d", cfg.EnrollLimit)
|
||||
}
|
||||
}
|
||||
|
||||
// Leere Werte (z. B. --public-url=${SULTAN_PUBLIC_URL} mit leerer Variable in
|
||||
// Compose) dürfen den Server nicht am Start hindern.
|
||||
func TestServerFlags_EmptyPublicURLIgnored(t *testing.T) {
|
||||
cfg, err := parseServerFlags([]string{"--public-url=", "--public-url= ", "--notify-slack="}, &bytes.Buffer{}, noEnv)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if len(cfg.PublicURLs) != 0 || len(cfg.SlackWebhooks) != 0 {
|
||||
t.Errorf("leere Werte übernommen: %q %q", cfg.PublicURLs, cfg.SlackWebhooks)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user