blueprints: file file observer on macos (#8472)
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user