feat: add --config-file CLI flag for YAML config
This commit is contained in:
+12
@@ -11,6 +11,7 @@ import qualified Options.Applicative as Opts
|
||||
import System.IO (BufferMode (NoBuffering), hSetBuffering, stderr, stdout)
|
||||
|
||||
import qualified Roux
|
||||
import qualified Roux.Config as Config
|
||||
|
||||
-- ---------------------------------------------------------------------------
|
||||
-- CLI options
|
||||
@@ -20,6 +21,7 @@ data Options = Options
|
||||
{ optHost :: String
|
||||
, optPort :: Int
|
||||
, optRecipeDir :: FilePath
|
||||
, optConfigFile :: FilePath
|
||||
}
|
||||
|
||||
optionsParser :: Opts.Parser Options
|
||||
@@ -49,6 +51,13 @@ optionsParser =
|
||||
<> Opts.value "recipes"
|
||||
<> Opts.showDefault
|
||||
)
|
||||
<*> Opts.strOption
|
||||
( Opts.long "config-file"
|
||||
<> Opts.metavar "FILE"
|
||||
<> Opts.help "Path to YAML configuration file"
|
||||
<> Opts.value "roux-config.yaml"
|
||||
<> Opts.showDefault
|
||||
)
|
||||
|
||||
main :: IO ()
|
||||
main = do
|
||||
@@ -71,6 +80,9 @@ main = do
|
||||
|
||||
putStrLn $ "[roux] scanning recipes from " <> optRecipeDir opts
|
||||
putStrLn $ "[roux] listening on " <> optHost opts <> ":" <> show (optPort opts)
|
||||
putStrLn $ "[roux] config file: " <> optConfigFile opts
|
||||
|
||||
-- Load config (file may be missing; LLM features disabled gracefully)
|
||||
_config <- Config.loadConfig (optConfigFile opts)
|
||||
waiApp <- Roux.app (optRecipeDir opts)
|
||||
Warp.runSettings settings waiApp
|
||||
|
||||
Reference in New Issue
Block a user