1
0
mirror of https://github.com/mainflux/mainflux.git synced 2025-04-29 13:49:28 +08:00
Drasko DRASKOVIC f090573567
NOISSUE - Improve MQTT benchmarking tools (#828)
* Refactor mqtt-bench

Signed-off-by: drasko <drasko.draskovic@gmail.com>

* Refactor mqtt-bench and provision tools

Signed-off-by: drasko <drasko.draskovic@gmail.com>

* Improve README

Signed-off-by: drasko <drasko.draskovic@gmail.com>

* Remove provision generated toml file

Signed-off-by: drasko <drasko.draskovic@gmail.com>

* Update README

Signed-off-by: drasko <drasko.draskovic@gmail.com>

* Replace `tcp` with `tcps` for mtls

Signed-off-by: drasko <drasko.draskovic@gmail.com>
2019-08-30 14:09:12 +02:00

44 lines
1.6 KiB
Go

// Copyright (c) Mainflux
// SPDX-License-Identifier: Apache-2.0
package main
import (
"log"
"github.com/mainflux/mainflux/tools/provision"
"github.com/spf13/cobra"
)
// Keep struct names exported, otherwise Viper unmarshaling won't work
type mqttBrokerCfg struct {
URL string `toml:"url" mapstructure:"url"`
}
func main() {
pconf := provision.Config{}
var rootCmd = &cobra.Command{
Use: "provision",
Short: "provision is provisioning tool for Mainflux",
Long: `Tool for provisioning series of Mainflux channels and things and connecting them together.
Complete documentation is available at https://mainflux.readthedocs.io`,
Run: func(cmd *cobra.Command, args []string) {
provision.Provision(pconf)
},
}
// Root Flags
rootCmd.PersistentFlags().StringVarP(&pconf.Host, "host", "", "https://localhost", "address for mainflux instance")
rootCmd.PersistentFlags().StringVarP(&pconf.Username, "username", "u", "", "mainflux user")
rootCmd.PersistentFlags().StringVarP(&pconf.Password, "password", "p", "", "mainflux users password")
rootCmd.PersistentFlags().IntVarP(&pconf.Num, "num", "", 10, "number of channels and things to create and connect")
rootCmd.PersistentFlags().BoolVarP(&pconf.SSL, "ssl", "", false, "create certificates for mTLS access")
rootCmd.PersistentFlags().StringVarP(&pconf.CAKey, "cakey", "", "ca.key", "ca.key for creating and signing things certificate")
rootCmd.PersistentFlags().StringVarP(&pconf.CA, "ca", "", "ca.crt", "CA for creating and signing things certificate")
if err := rootCmd.Execute(); err != nil {
log.Fatal(err)
}
}