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 committed by David Allen
parent 07e3d0eb7a
commit 149fcaec6d
Signed by: towk
GPG key ID: 0430CDBE22619155

View file

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