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

34 lines
677 B
Go
Raw Normal View History

2023-07-05 22:07:10 +02:00
package prosody
2023-07-07 23:06:47 +02:00
import (
"fmt"
2023-08-04 23:01:56 +02:00
"log"
2023-07-07 23:06:47 +02:00
"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-08-04 23:01:56 +02:00
log.Println("/var/lib/prosody/" + domain + "/accounts/")
log.Println(plainDomain)
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
}