aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config.yaml.sample2
-rw-r--r--lib/Config.hs9
2 files changed, 8 insertions, 3 deletions
diff --git a/config.yaml.sample b/config.yaml.sample
index c785144..41072b0 100644
--- a/config.yaml.sample
+++ b/config.yaml.sample
@@ -2,7 +2,7 @@
dbstring: "dbname=tracktrain"
gtfs: "gtfs.zip"
-zoneinfoPath: "/etc/zoneinfo/"
+zoneinfopath: "/etc/zoneinfo/"
assets: ./assets
diff --git a/lib/Config.hs b/lib/Config.hs
index ef90fc1..4c8e3fd 100644
--- a/lib/Config.hs
+++ b/lib/Config.hs
@@ -2,15 +2,17 @@
{-# LANGUAGE RecordWildCards #-}
module Config (UffdConfig(..), ServerConfig(..), LoggingConfig(..)) where
-import Conferer (DefaultConfig (configDef))
+import Conferer (DefaultConfig (configDef), fetch,
+ unsafeFetchKey)
import Conferer.FromConfig
import Conferer.FromConfig.Warp ()
import Data.ByteString (ByteString)
import Data.Functor ((<&>))
import Data.Text (Text)
+import qualified Data.Text as T
import GHC.Generics (Generic)
import Network.Wai.Handler.Warp (Settings)
-import System.OsPath (OsPath, osp)
+import System.OsPath (OsPath, encodeUtf, osp)
import URI.ByteString
data UffdConfig = UffdConfig
@@ -39,6 +41,9 @@ data LoggingConfig = LoggingConfig
instance FromConfig ServerConfig
+instance FromConfig OsPath where
+ fromConfig = fetchFromConfigWith (encodeUtf . T.unpack)
+
instance DefaultConfig ServerConfig where
configDef = ServerConfig
{ serverConfigWarp = configDef