refactor: changed to use local store with static store fallback

This commit is contained in:
David Allen 2025-03-20 08:59:48 -06:00
parent df77e075ef
commit 41346aebbb
Signed by: towk
GPG key ID: 793B2924A49B3A3F

View file

@ -36,13 +36,17 @@ var CrawlCmd = &cobra.Command{
return nil return nil
}, },
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
staticStore := &secrets.StaticStore{ store, err := secrets.OpenStore(secretsFile)
Username: viper.GetString("crawl.username"), if err != nil {
Password: viper.GetString("crawl.password"), fmt.Println(err)
store = &secrets.StaticStore{
Username: viper.GetString("crawl.username"),
Password: viper.GetString("crawl.password"),
}
} }
systems, err := crawler.CrawlBMCForSystems(crawler.CrawlerConfig{ systems, err := crawler.CrawlBMCForSystems(crawler.CrawlerConfig{
URI: args[0], URI: args[0],
CredentialStore: staticStore, CredentialStore: store,
Insecure: cmd.Flag("insecure").Value.String() == "true", Insecure: cmd.Flag("insecure").Value.String() == "true",
}) })
if err != nil { if err != nil {