fix(stalwart): use v0.16 management JMAP endpoint

This commit is contained in:
Meghdad committed 2026-08-13 04:20:33 +03:30
1 parent 493cc66bed
commit 2d84a780d4
5 files changed
+104 -12

No files matched your search

+3 -3
View File
@@ -252,7 +252,7 @@ func createAPIKey(args []string) error {
func configureTLS(args []string) error {
fs := flag.NewFlagSet("configure-tls", flag.ContinueOnError)
dir := fs.String("directory", ".", "Compose bundle directory")
endpoint := fs.String("url", "http://127.0.0.1:8081/api", "loopback Stalwart management endpoint")
endpoint := fs.String("url", "http://127.0.0.1:8081/jmap", "loopback Stalwart management JMAP endpoint")
certificatePath := fs.String("certificate-path", "/etc/stalwart/tls/fullchain.pem", "certificate path inside the Stalwart container")
privateKeyPath := fs.String("private-key-path", "/etc/stalwart/tls/privkey.pem", "private key path inside the Stalwart container")
if err := fs.Parse(args); err != nil {
@@ -260,8 +260,8 @@ func configureTLS(args []string) error {
}
root, _ := filepath.Abs(*dir)
managementURL, err := url.Parse(*endpoint)
if err != nil || managementURL.Scheme != "http" || managementURL.Path != "/api" || managementURL.User != nil || managementURL.RawQuery != "" || managementURL.Fragment != "" {
return errors.New("--url must be a loopback HTTP URL ending in /api")
if err != nil || managementURL.Scheme != "http" || managementURL.Path != "/jmap" || managementURL.User != nil || managementURL.RawQuery != "" || managementURL.Fragment != "" {
return errors.New("--url must be a loopback HTTP URL ending in /jmap")
}
managementHost := managementURL.Hostname()
managementIP := net.ParseIP(managementHost)
+2 -2
View File
@@ -38,14 +38,14 @@ func TestJMAPSucceededRejectsFailedUpdate(t *testing.T) {
}
func TestConfigureTLSRejectsRemoteManagementURL(t *testing.T) {
err := configureTLS([]string{"--directory", t.TempDir(), "--url", "http://mail.example.com/api"})
err := configureTLS([]string{"--directory", t.TempDir(), "--url", "http://mail.example.com/jmap"})
if err == nil || !strings.Contains(err.Error(), "loopback") {
t.Fatalf("expected loopback URL rejection, got %v", err)
}
}
func TestConfigureTLSRejectsHTTPSManagementURL(t *testing.T) {
err := configureTLS([]string{"--directory", t.TempDir(), "--url", "https://127.0.0.1:8081/api"})
err := configureTLS([]string{"--directory", t.TempDir(), "--url", "https://127.0.0.1:8081/jmap"})
if err == nil || !strings.Contains(err.Error(), "loopback HTTP URL") {
t.Fatalf("expected plain loopback HTTP requirement, got %v", err)
}