diff --git a/cmd/crawl.go b/cmd/crawl.go index 12203eb..db9821c 100644 --- a/cmd/crawl.go +++ b/cmd/crawl.go @@ -40,8 +40,8 @@ var CrawlCmd = &cobra.Command{ if err != nil { fmt.Println(err) store = &secrets.StaticStore{ - Username: viper.GetString("crawl.username"), - Password: viper.GetString("crawl.password"), + Username: username, + Password: password, } } systems, err := crawler.CrawlBMCForSystems(crawler.CrawlerConfig{ @@ -65,9 +65,9 @@ var CrawlCmd = &cobra.Command{ } func init() { - CrawlCmd.Flags().StringP("username", "u", "", "Set the username for the BMC") - CrawlCmd.Flags().StringP("password", "p", "", "Set the password for the BMC") - CrawlCmd.Flags().BoolP("insecure", "i", false, "Ignore SSL errors") + CrawlCmd.Flags().StringVarP(&username, "username", "u", "", "Set the username for the BMC") + CrawlCmd.Flags().StringVarP(&password, "password", "p", "", "Set the password for the BMC") + 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") checkBindFlagError(viper.BindPFlag("crawl.username", CrawlCmd.Flags().Lookup("username"))) diff --git a/cmd/root.go b/cmd/root.go index 3b0d4f0..ae43a53 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -44,6 +44,7 @@ var ( verbose bool debug bool forceUpdate bool + insecure bool ) // The `root` command doesn't do anything on it's own except display