File Watcher Module

File watcher service for dynamic configuration loading.

credproxy.file_watcher.should_include_file(file_path: str, include_patterns: list[str], exclude_patterns: list[str]) bool[source]

Apply filtering logic: exclude first, then include. Returns True if file should be processed.

Parameters:
  • file_path – Path to file to check

  • include_patterns – List of regex patterns to include (if empty, include all non-excluded)

  • exclude_patterns

    List of regex patterns to exclude

    Returns:

    True if file should be processed, False otherwise

credproxy.file_watcher.get_directory_patterns(file_path: str, directories: list) tuple[list[str], list[str]][source]

Get the include and exclude patterns for the directory that contains the given file.

Parameters:
  • file_path – Path to the file to check

  • directories – List of DirectoryConfig objects

Returns:

Tuple of (include_patterns, exclude_patterns) for the matching directory

class credproxy.file_watcher.ServiceFileHandler(*args: Any, **kwargs: Any)[source]

Bases: FileSystemEventHandler

Handle file system events for service configuration files.

__init__(config: Config, reload_interval: int)[source]
on_created(event: watchdog.events.FileSystemEvent) None[source]

Handle file creation events.

on_modified(event: watchdog.events.FileSystemEvent) None[source]

Handle file modification events.

on_deleted(event: watchdog.events.FileSystemEvent) None[source]

Handle file deletion events.

class credproxy.file_watcher.FileWatcherService(config: Config)[source]

Bases: object

Service for monitoring configuration directory for changes.

__init__(config: Config)[source]
start() None[source]

Start the file watcher service.

stop() None[source]

Stop the file watcher service.

is_running() bool[source]

Check if the file watcher service is running.