prosody-password/internal/services/prosody/prosody.go

34 lines
677 B
Go

package prosody
import (
"fmt"
"log"
"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))
}
log.Println("/var/lib/prosody/" + domain + "/accounts/")
log.Println(plainDomain)
return &Prosody{
binPath: "/usr/bin/prosodyctl",
accountsPath: "/var/lib/prosody/" + domain + "/accounts/",
plainDomain: plainDomain,
}
}
func (p *Prosody) WithBinPath(binPath string) *Prosody {
p.binPath = binPath
return p
}