Harden mutation admission and storage observation
This commit is contained in:
parent
435d4fea4c
commit
1b1d8b06c7
1 changed files with 969 additions and 461 deletions
12
app/Main.hs
12
app/Main.hs
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue