mirror of
https://github.com/shirou/mqttcli.git
synced 2025-04-26 13:49:17 +08:00
if host and port specified, not read from file.
This commit is contained in:
parent
a1c7c40724
commit
e6d0151ae9
9
mqtt.go
9
mqtt.go
@ -76,7 +76,12 @@ func getRandomClientId() string {
|
||||
func NewOption(c *cli.Context) *MQTT.ClientOptions {
|
||||
opts := MQTT.NewClientOptions()
|
||||
|
||||
getSettingsFromFile(c.String("conf"), opts)
|
||||
host := c.String("host")
|
||||
port := c.Int("p")
|
||||
|
||||
if host == "" && port == 0 {
|
||||
getSettingsFromFile(c.String("conf"), opts)
|
||||
}
|
||||
|
||||
clientId := c.String("i")
|
||||
if clientId == "" {
|
||||
@ -104,8 +109,6 @@ func NewOption(c *cli.Context) *MQTT.ClientOptions {
|
||||
opts.SetPassword(password)
|
||||
}
|
||||
|
||||
host := c.String("host")
|
||||
port := c.Int("p")
|
||||
if host != "" {
|
||||
brokerUri := fmt.Sprintf("%s://%s:%d", scheme, host, port)
|
||||
log.Infof("Broker URI: %s", brokerUri)
|
||||
|
Loading…
x
Reference in New Issue
Block a user