fix panic

This commit is contained in:
2023-07-07 23:06:47 +02:00
parent b2e65a9df0
commit 40d11f97f4
2 changed files with 17 additions and 2 deletions

View File

@@ -1,15 +1,26 @@
package prosody
import (
"fmt"
"net/url"
)
type Prosody struct {
binPath string
plainDomain string
accountsPath string
}
// /var/lib/prosody/xmpp%%2eurkob%%2ecom/accounts/
func NewProsody(domain string) *Prosody {
plainDomain, err := url.QueryUnescape(domain)
if err != nil {
panic(fmt.Errorf("urlQueryUnescape %w", err))
}
return &Prosody{
binPath: "/usr/bin/prosodyctl",
accountsPath: "/var/lib/prosody/" + domain + "/accounts/",
plainDomain: plainDomain,
}
}