Harden mutation admission and storage observation

This commit is contained in:
ms2k 2026-07-18 15:22:57 +09:00
commit 1b1d8b06c7

View file

@ -15,7 +15,7 @@ import Nuthatch
import Nuthatch.Db (migrate, query_, withDb)
import Nuthatch.Redis (withRedis)
import Nuthatch.S3 (newS3)
import System.Directory (doesFileExist)
import System.Directory (doesDirectoryExist)
import System.FilePath ((</>))
import System.IO (BufferMode (LineBuffering), hSetBuffering, stdout)
@ -62,14 +62,14 @@ waitForPostgres cfg = go (60 :: Int)
findSchema :: IO FilePath
findSchema = do
let candidates =
[ "sql" </> "001_schema.sql"
, ".." </> "sql" </> "001_schema.sql"
, "/app/sql" </> "001_schema.sql"
[ "sql"
, ".." </> "sql"
, "/app/sql"
]
existing <- mapM (\p -> doesFileExist p >>= \e -> pure (e, p)) candidates
existing <- mapM (\p -> doesDirectoryExist p >>= \e -> pure (e, p)) candidates
pure $ case [p | (True, p) <- existing] of
(p : _) -> p
[] -> "sql/001_schema.sql"
[] -> "sql"
readHost :: String -> HostPreference
readHost = fromString