diff --git a/compose.yml b/compose.yml index 0e4bb10..4aaf10d 100644 --- a/compose.yml +++ b/compose.yml @@ -38,6 +38,8 @@ services: networks: - flod_nw restart: unless-stopped + volumes: + - importer-lists:/lists redis: image: redis:7-alpine @@ -68,3 +70,4 @@ networks: volumes: redis-data: + importer-lists: diff --git a/main.go b/main.go index 00b308c..8943636 100644 --- a/main.go +++ b/main.go @@ -707,6 +707,9 @@ func fetchAndSave(client *http.Client, t target, outDir string) error { func importBlocklists() error { client := &http.Client{Timeout: 60 * time.Second} t := target{Name: "Catalog", URL: "http://importer:8080/lists.json"} + if err := os.MkdirAll("./lists/", 0o755); err != nil { + fmt.Println("creating output dir", err) + } if err := fetchAndSave(client, t, "./lists/"); err != nil { log.Printf("ERROR %s → %v", t.URL, err) }