mirror of
https://github.com/davidallendj/magellan.git
synced 2025-12-20 11:37:01 -07:00
refactor: use vars for cred flags
This commit is contained in:
parent
d1042d77aa
commit
5c4ca34976
2 changed files with 6 additions and 5 deletions
10
cmd/crawl.go
10
cmd/crawl.go
|
|
@ -40,8 +40,8 @@ var CrawlCmd = &cobra.Command{
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
store = &secrets.StaticStore{
|
store = &secrets.StaticStore{
|
||||||
Username: viper.GetString("crawl.username"),
|
Username: username,
|
||||||
Password: viper.GetString("crawl.password"),
|
Password: password,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
systems, err := crawler.CrawlBMCForSystems(crawler.CrawlerConfig{
|
systems, err := crawler.CrawlBMCForSystems(crawler.CrawlerConfig{
|
||||||
|
|
@ -65,9 +65,9 @@ var CrawlCmd = &cobra.Command{
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
CrawlCmd.Flags().StringP("username", "u", "", "Set the username for the BMC")
|
CrawlCmd.Flags().StringVarP(&username, "username", "u", "", "Set the username for the BMC")
|
||||||
CrawlCmd.Flags().StringP("password", "p", "", "Set the password for the BMC")
|
CrawlCmd.Flags().StringVarP(&password, "password", "p", "", "Set the password for the BMC")
|
||||||
CrawlCmd.Flags().BoolP("insecure", "i", false, "Ignore SSL errors")
|
CrawlCmd.Flags().BoolVarP(&insecure, "insecure", "i", false, "Ignore SSL errors")
|
||||||
CrawlCmd.Flags().StringVarP(&secretsFile, "file", "f", "nodes.json", "set the secrets file with BMC credentials")
|
CrawlCmd.Flags().StringVarP(&secretsFile, "file", "f", "nodes.json", "set the secrets file with BMC credentials")
|
||||||
|
|
||||||
checkBindFlagError(viper.BindPFlag("crawl.username", CrawlCmd.Flags().Lookup("username")))
|
checkBindFlagError(viper.BindPFlag("crawl.username", CrawlCmd.Flags().Lookup("username")))
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,7 @@ var (
|
||||||
verbose bool
|
verbose bool
|
||||||
debug bool
|
debug bool
|
||||||
forceUpdate bool
|
forceUpdate bool
|
||||||
|
insecure bool
|
||||||
)
|
)
|
||||||
|
|
||||||
// The `root` command doesn't do anything on it's own except display
|
// The `root` command doesn't do anything on it's own except display
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue