From 60bde7009cb492d5ea204e909e1fabc68a7d32f2 Mon Sep 17 00:00:00 2001 From: stuebinm Date: Fri, 17 Jun 2022 23:12:18 +0200 Subject: make connstring configurable at runtime --- app/Main.hs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'app') diff --git a/app/Main.hs b/app/Main.hs index e47ffc4..ec4b5e7 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -1,3 +1,5 @@ +{-# LANGUAGE LambdaCase #-} + -- | The main module. Does little more than handle some basic ocnfic, then -- call the server module Main where @@ -11,14 +13,18 @@ import Network.Wai.Handler.Warp (run) import Network.Wai.Middleware.RequestLogger (OutputFormat (..), RequestLoggerSettings (..), mkRequestLogger) +import System.Environment (getArgs) +import Data.Functor ((<&>)) +import Data.ByteString.Internal (packChars) import GTFS import Server -connStr = "user=travelynx" main :: IO () main = do + connStr <- getArgs <&> \case {[str] -> packChars str; _ -> ""} + gtfs <- loadGtfs "./gtfs.zip" loggerMiddleware <- mkRequestLogger $ def { outputFormat = Detailed True } -- cgit v1.2.3