fix: handle FileSystem :ignore in ProfileWatcher for CI

This commit is contained in:
Graham McIntire 2026-03-07 16:02:32 -06:00
parent 6ad7f7233d
commit 1987d84637
No known key found for this signature in database

View file

@ -29,12 +29,17 @@ defmodule Towerops.Profiles.ProfileWatcher do
profiles_path = Path.join(Application.app_dir(:towerops), @profiles_dir)
# Start watching the profiles directory for changes (using apply to avoid compile-time warnings)
{:ok, watcher_pid} = apply(FileSystem, :start_link, [[dirs: [profiles_path]]])
apply(FileSystem, :subscribe, [watcher_pid])
case apply(FileSystem, :start_link, [[dirs: [profiles_path]]]) do
{:ok, watcher_pid} ->
apply(FileSystem, :subscribe, [watcher_pid])
Logger.info("ProfileWatcher: Started watching #{profiles_path}")
{:ok, %{watcher_pid: watcher_pid, profiles_path: profiles_path}}
Logger.info("ProfileWatcher: Started watching #{profiles_path}")
{:ok, %{watcher_pid: watcher_pid, profiles_path: profiles_path}}
:ignore ->
# inotify-tools not available (e.g., in CI)
Logger.debug("ProfileWatcher: FileSystem watcher not available, running in no-op mode")
{:ok, %{}}
end
else
# In production, FileSystem is not available
Logger.debug("ProfileWatcher: FileSystem not available, running in no-op mode (dev-only feature)")