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

31 lines
586 B
Go
Raw Permalink Normal View History

2023-07-05 22:07:10 +02:00
package prosody
2023-07-07 23:06:47 +02:00
import (
"fmt"
"net/url"
)
2023-07-05 22:07:10 +02:00
type Prosody struct {
binPath string
2023-07-07 23:06:47 +02:00
plainDomain string
2023-07-05 22:07:10 +02:00
accountsPath string
}
// /var/lib/prosody/xmpp%%2eurkob%%2ecom/accounts/
func NewProsody(domain string) *Prosody {
2023-07-07 23:06:47 +02:00
plainDomain, err := url.QueryUnescape(domain)
if err != nil {
panic(fmt.Errorf("urlQueryUnescape %w", err))
}
2023-07-05 22:07:10 +02:00
return &Prosody{
binPath: "/usr/bin/prosodyctl",
accountsPath: "/var/lib/prosody/" + domain + "/accounts/",
2023-07-07 23:06:47 +02:00
plainDomain: plainDomain,
2023-07-05 22:07:10 +02:00
}
}
func (p *Prosody) WithBinPath(binPath string) *Prosody {
p.binPath = binPath
return p
}