mirror of
https://github.com/FluuxIO/go-xmpp.git
synced 2024-11-21 01:52:01 -08:00
add parameter and config for address to sendxmpp
This commit is contained in:
parent
3daa5c505c
commit
e3e57ac803
@ -21,7 +21,8 @@ Examples:
|
||||
sendxmpp to@chat.sum7.eu "Hello World!"
|
||||
|
||||
Flags:
|
||||
--config string config file (default is ~/.config/fluxxmpp.toml)
|
||||
--addr string host[:port]
|
||||
--config string config file (default is ~/.config/fluxxmpp.yml)
|
||||
-h, --help help for sendxmpp
|
||||
--jid string using jid (required)
|
||||
-m, --muc reciever is a muc (join it before sending messages)
|
||||
@ -105,6 +106,8 @@ e.g. ~/.config/fluxxmpp.toml
|
||||
```toml
|
||||
jid = "bot@example.org"
|
||||
password = "secret"
|
||||
|
||||
addr = "example.com:5222"
|
||||
```
|
||||
|
||||
#### Enviroment variable
|
||||
@ -112,6 +115,8 @@ password = "secret"
|
||||
export FLUXXMPP_JID='bot@example.org';
|
||||
export FLUXXMPP_PASSWORD='secret';
|
||||
|
||||
export FLUXXMPP_ADDR='example.com:5222';
|
||||
|
||||
sendxmpp to@example.org "Hello Welt";
|
||||
```
|
||||
|
||||
@ -120,5 +125,5 @@ Warning: This should not be used in productiv system.
|
||||
(Every user on the system could read the running processes with parameter - on this way the password)
|
||||
|
||||
```bash
|
||||
sendxmpp to@example.org "Hello Welt" --jid bot@example.org --password secret;
|
||||
sendxmpp to@example.org "Hello Welt" --jid bot@example.org --password secret --addr example.com:5222;
|
||||
```
|
||||
|
@ -39,6 +39,7 @@ var cmd = &cobra.Command{
|
||||
var err error
|
||||
client, err := xmpp.NewClient(xmpp.Config{
|
||||
Jid: viper.GetString("jid"),
|
||||
Address: viper.GetString("addr"),
|
||||
Password: viper.GetString("password"),
|
||||
}, xmpp.NewRouter())
|
||||
|
||||
@ -97,6 +98,9 @@ func init() {
|
||||
cmd.Flags().StringP("password", "", "", "using password for your jid (required)")
|
||||
viper.BindPFlag("password", cmd.Flags().Lookup("password"))
|
||||
|
||||
cmd.Flags().StringP("addr", "", "", "host[:port]")
|
||||
viper.BindPFlag("addr", cmd.Flags().Lookup("addr"))
|
||||
|
||||
cmd.Flags().BoolVarP(&stdIn, "stdin", "i", false, "read from stdin instatt of 2. argument")
|
||||
cmd.Flags().BoolVarP(&receiverMUC, "muc", "m", false, "reciever is a muc (join it before sending messages)")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user