Explorar o código

load hub file properly when restoring config from tmpdir (#847)

Thibault "bui" Koechlin %!s(int64=4) %!d(string=hai) anos
pai
achega
ca3e9ea487
Modificáronse 1 ficheiros con 7 adicións e 0 borrados
  1. 7 0
      cmd/crowdsec-cli/utils.go

+ 7 - 0
cmd/crowdsec-cli/utils.go

@@ -535,6 +535,13 @@ func silenceInstallItem(name string, obtype string) (string, error) {
 func RestoreHub(dirPath string) error {
 	var err error
 
+	if err := csConfig.LoadHub(); err != nil {
+		return err
+	}
+	if err := setHubBranch(); err != nil {
+		return fmt.Errorf("error while setting hub branch: %s", err)
+	}
+
 	for _, itype := range cwhub.ItemTypes {
 		itemDirectory := fmt.Sprintf("%s/%s/", dirPath, itype)
 		if _, err = os.Stat(itemDirectory); err != nil {