mirror of
https://github.com/tulir/gomuks.git
synced 2025-04-20 10:33:41 -05:00
Configure MxID and homeserver in headless startup
This commit is contained in:
parent
5db39fd50a
commit
c628bfb97c
1 changed files with 10 additions and 5 deletions
|
@ -9,6 +9,7 @@ import (
|
|||
"maunium.net/go/mautrix"
|
||||
"maunium.net/go/mautrix/crypto"
|
||||
"maunium.net/go/mautrix/crypto/ssss"
|
||||
"maunium.net/go/mautrix/id"
|
||||
|
||||
"maunium.net/go/gomuks/initialize"
|
||||
"maunium.net/go/gomuks/matrix"
|
||||
|
@ -16,10 +17,8 @@ import (
|
|||
)
|
||||
|
||||
type HeadlessConfig struct {
|
||||
OutputDir,
|
||||
MxID, MxPassword,
|
||||
KeyPath, KeyPassword,
|
||||
RecoveryPhrase string
|
||||
OutputDir, MxPassword, KeyPath, KeyPassword, RecoveryPhrase string
|
||||
MxID id.UserID
|
||||
}
|
||||
|
||||
func HeadlessInit(conf HeadlessConfig) error {
|
||||
|
@ -39,9 +38,15 @@ func HeadlessInit(conf HeadlessConfig) error {
|
|||
}
|
||||
|
||||
// login section
|
||||
_, hs, err := conf.MxID.Parse()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
gmx.Config().HS = hs
|
||||
if err := gmx.Matrix().InitClient(false); err != nil {
|
||||
return err
|
||||
} else if err = gmx.Matrix().Login(conf.MxID, conf.MxPassword); err != nil {
|
||||
} else if err = gmx.Matrix().Login(conf.MxID.String(), conf.MxPassword); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue