From dd7158cdff186028fe128ca9fca52f0e558adadc Mon Sep 17 00:00:00 2001 From: Lucy Cifferello <12953208+elvece@users.noreply.github.com> Date: Wed, 12 Apr 2023 17:35:50 -0600 Subject: [PATCH] ensure empty whitelist can be parsed --- src/Settings.hs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/Settings.hs b/src/Settings.hs index 2f6ab63..1921be0 100644 --- a/src/Settings.hs +++ b/src/Settings.hs @@ -17,7 +17,7 @@ import Startlude ( ($) , ByteString , ConvertText(toS) , FilePath - + , Monad(return) , Monoid(mempty) , Text @@ -25,6 +25,7 @@ import Startlude ( ($) , either , id , panic + , map ) import qualified Control.Exception as Exception @@ -59,7 +60,7 @@ import Orphans.Emver ( ) import Lib.Types.Core (PkgId) import Data.String import Data.List.Extra (splitOn) -import Prelude (map, read) +import Text.Read (read) -- | Runtime settings to configure this application. These settings can be -- loaded from various sources: defaults, environment variables, config files, -- theoretically even a database. @@ -149,6 +150,7 @@ compileTimeAppSettings = case fromJSON $ applyEnvValue False mempty configSettin Success settings -> settings parseCommaSeparatedList :: String -> [PkgId] -parseCommaSeparatedList input = do - let strings = splitOn "," input - map read strings \ No newline at end of file +parseCommaSeparatedList input = + case splitOn "," input of + [""] -> [] + xs -> map read xs \ No newline at end of file