1
0
Fork 0
mirror of https://github.com/binwiederhier/ntfy.git synced 2025-06-15 00:53:18 +02:00

Add support for auth in client config

This commit is contained in:
lrabane 2022-02-17 19:16:01 +01:00
parent f4f5edb230
commit b89c18e83d
4 changed files with 18 additions and 5 deletions

View file

@ -162,6 +162,9 @@ func doSubscribe(c *cli.Context, cl *client.Client, conf *client.Config, topic,
for filter, value := range s.If {
topicOptions = append(topicOptions, client.WithFilter(filter, value))
}
if s.User != "" && s.Password != "" {
topicOptions = append(topicOptions, client.WithBasicAuth(s.User, s.Password))
}
subscriptionID := cl.Subscribe(s.Topic, topicOptions...)
commands[subscriptionID] = s.Command
}