From 715889a72aa4806d5e0b4b11878dccca6d4f4fd1 Mon Sep 17 00:00:00 2001 From: James Brechtel Date: Wed, 15 Jul 2026 15:55:54 -0400 Subject: [PATCH] feat: add --db-path CLI option and open SQLite db on startup --- app/Main.hs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/app/Main.hs b/app/Main.hs index f842f72..29c709f 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -10,11 +10,13 @@ import Network.Wai.Handler.Warp qualified as Warp import Options.Applicative qualified as Opt import System.Posix.Signals qualified as Signals +import Sis.Database qualified as Database import Sis.Server qualified as Sis data Options = Options { optPort :: Int , optStaticDir :: FilePath + , optDbPath :: FilePath } optionsParser :: Opt.Parser Options @@ -36,6 +38,13 @@ optionsParser = <> Opt.value "frontend/dist" <> Opt.showDefault ) + <*> Opt.strOption + ( Opt.long "db-path" + <> Opt.metavar "PATH" + <> Opt.help "Path to the SQLite database file" + <> Opt.value "data/sis.db" + <> Opt.showDefault + ) main :: IO () main = do @@ -46,6 +55,8 @@ main = do <> Opt.progDesc "Sis — shared household chore tracker" <> Opt.header "sis-server" + _db <- Database.openDatabase (optDbPath opts) + -- Install a SIGTERM handler so Docker stop works cleanly. _ <- Signals.installHandler