blueprints: file file observer on macos (#8472)

Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
Jens L
2024-02-12 00:17:56 +01:00
committed by GitHub
parent 7db598c04e
commit 08c850938b

View File

@ -3,6 +3,7 @@
from dataclasses import asdict, dataclass, field from dataclasses import asdict, dataclass, field
from hashlib import sha512 from hashlib import sha512
from pathlib import Path from pathlib import Path
from sys import platform
from typing import Optional from typing import Optional
from dacite.core import from_dict from dacite.core import from_dict
@ -60,11 +61,11 @@ def start_blueprint_watcher():
if _file_watcher_started: if _file_watcher_started:
return return
observer = Observer() observer = Observer()
kwargs = {}
if platform.startswith("linux"):
kwargs["event_filter"] = (FileCreatedEvent, FileModifiedEvent)
observer.schedule( observer.schedule(
BlueprintEventHandler(), BlueprintEventHandler(), CONFIG.get("blueprints_dir"), recursive=True, **kwargs
CONFIG.get("blueprints_dir"),
recursive=True,
event_filter=(FileCreatedEvent, FileModifiedEvent),
) )
observer.start() observer.start()
_file_watcher_started = True _file_watcher_started = True