aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authoralexwl <alexey.a.kiryushin@gmail.com>2019-03-26 17:07:04 +0300
committeralexwl <alexey.a.kiryushin@gmail.com>2019-03-26 17:07:04 +0300
commit72dcd0ac259723a524a83dd79d4dff7f74acdc74 (patch)
tree4402dee3b40bf7102ad284816536b642fa7c4894 /app
parent3bff037c1f36078c8543983e0d87731e8d073bc4 (diff)
Update parsePackagesPath so that --package and --packages options can be specified independently
Diffstat (limited to 'app')
-rw-r--r--app/Server.hs12
1 files changed, 9 insertions, 3 deletions
diff --git a/app/Server.hs b/app/Server.hs
index 9544539..de2c325 100644
--- a/app/Server.hs
+++ b/app/Server.hs
@@ -265,8 +265,8 @@ configParser =
parsePackagesPath :: Parser FilePath -> Parser [FilePath] -> Parser PackagesPath
parsePackagesPath parseDir parsePaths =
- (PackagesPath <$> fmap Just parseDir <*> parsePaths)
- <|> pure (PackagesPath Nothing ["."])
+ PackagesPath <$> optional parseDir <*> (parsePaths <|> pure [])
+
--------------------------------------------------------------------------------
-- Loading packages
@@ -1851,7 +1851,13 @@ application env = serve (Proxy :: Proxy API) (server env)
main :: IO ()
main = do
+ let addDefaultPath :: ServerConfig -> ServerConfig
+ addDefaultPath config =
+ if configPackagesPath config == PackagesPath Nothing []
+ then config {configPackagesPath = PackagesPath Nothing ["."]}
+ else config
config <-
+ addDefaultPath <$>
execParser
(Options.Applicative.info
(configParser <**> helper)
@@ -1883,7 +1889,7 @@ main = do
loggerMiddleware <-
liftIO $
mkRequestLogger
- def {outputFormat = Detailed True, destination = Logger loggerSet}
+ def {outputFormat = Detailed True, destination = Logger loggerSet}
let staticFilePrefix = configStaticFilesUrlPrefix config
mbJsDistPath = configJsDistDirectory config
environment =