mirror of
https://codeberg.org/june64/mrvc.git
synced 2026-01-10 16:06:33 +01:00
combine localpart and homeserver arguments into one and validate that
Combine the user localpart and homeserver arguments into one user id argument and validate that.
This commit is contained in:
parent
1d7ed285bf
commit
d2f9c2d63a
1 changed files with 7 additions and 3 deletions
10
main.go
10
main.go
|
|
@ -281,16 +281,20 @@ func compareVersionStrings(a, b string) int {
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
userLocalpart := os.Getenv("MATRIX_USER_LOCALPART")
|
userIdString := os.Getenv("MATRIX_USER_ID")
|
||||||
homeserver := os.Getenv("MATRIX_HOMESERVER")
|
|
||||||
token := os.Getenv("MATRIX_TOKEN")
|
token := os.Getenv("MATRIX_TOKEN")
|
||||||
room := os.Getenv("MATRIX_ROOM")
|
room := os.Getenv("MATRIX_ROOM")
|
||||||
verbose := false
|
verbose := false
|
||||||
timeoutSeconds := 5
|
timeoutSeconds := 5
|
||||||
|
|
||||||
|
userId := id.UserID(userIdString)
|
||||||
|
_, homeserver, err := userId.ParseAndValidate()
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
client, err := mautrix.NewClient(
|
client, err := mautrix.NewClient(
|
||||||
homeserver,
|
homeserver,
|
||||||
id.NewUserID(userLocalpart, homeserver),
|
userId,
|
||||||
token,
|
token,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue