@@ -41,8 +41,8 @@ import Data.Text (Text)
4141import qualified Data.Text as T
4242import Data.Text.Encoding
4343import Obelisk.Asset.Serve.Snap (serveAsset)
44−import Obelisk.ExecutableConfig.Backend
45−import Obelisk.ExecutableConfig.Lookup
44+import Obelisk.Configs
45+import qualified Obelisk.ExecutableConfig.Lookup as Lookup
4646import Obelisk.Frontend
4747import Obelisk.Route
4848import Obelisk.Snap.Extras (doNotCache, serveFileIfExistsAs)
@@ -55,14 +55,14 @@ import System.IO (BufferMode (..), hSetBuffering, stderr, stdout)
5555
5656data Backend backendRoute frontendRoute = Backend
5757 { _backend_routeEncoder :: Encoder (Either Text) Identity (R (Sum backendRoute (ObeliskRoute frontendRoute))) PageName
58− , _backend_run :: ((R backendRoute -> BackendConfigsT Snap ()) -> BackendConfigsT IO ()) -> BackendConfigsT IO ()
58+ , _backend_run :: ((R backendRoute -> ConfigsT Snap ()) -> ConfigsT IO ()) -> ConfigsT IO ()
5959 }
6060
61−-- | All the configs separated by which context they are accessible in. (Common
62−-- configs are present in both.)
61+-- | All the configs separated by which context they are accessible in. Common
62+-- and frontend configs are present in both.
6363data ComponentConfigs = ComponentConfigs
64− { _componentConfigs_backend :: Map Text Text
65− , _componentConfigs_frontend :: Map Text Text
64+ { _componentConfigs_backend :: Map Text ByteString
65+ , _componentConfigs_frontend :: Map Text ByteString
6666 }
6767
6868-- | The static assets provided must contain a compiled GHCJS app that corresponds exactly to the Frontend provided
@@ -80,7 +80,7 @@ serveDefaultObeliskApp
8080 -> ([Text]
8181 -> m ())
8282 -> Frontend (R appRoute)
83− -> Map Text Text
83+ -> Map Text ByteString
8484 -> R (ObeliskRoute appRoute)
8585 -> m ()
8686serveDefaultObeliskApp urlEnc serveStaticAsset frontend configs = serveObeliskApp urlEnc serveStaticAsset frontendApp configs
@@ -139,7 +139,7 @@ serveObeliskApp
139139 => (R appRoute -> Text)
140140 -> ([Text] -> m ())
141141 -> GhcjsApp (R appRoute)
142− -> Map Text Text
142+ -> Map Text ByteString
143143 -> R (ObeliskRoute appRoute)
144144 -> m ()
145145serveObeliskApp urlEnc serveStaticAsset frontendApp config = \case
@@ -174,7 +174,7 @@ serveGhcjsApp
174174 :: (MonadSnap m, HasCookies m)
175175 => (R appRouteComponent -> Text)
176176 -> GhcjsApp (R appRouteComponent)
177− -> Map Text Text
177+ -> Map Text ByteString
178178 -> R (GhcjsAppRoute appRouteComponent)
179179 -> m ()
180180serveGhcjsApp urlEnc app config = \case
@@ -188,13 +188,13 @@ runBackend backend frontend = case checkEncoder $ _backend_routeEncoder backend
188188 Left e -> fail $ "backend error:\n" <> T.unpack e
189189 Right validFullEncoder -> do
190190 configs <- getComponentConfigs
191− runBackendConfigsT (_componentConfigs_backend configs) $
191+ runConfigsT (_componentConfigs_backend configs) $
192192 _backend_run backend $ \serveRoute -> do
193193 runSnapWithCommandLineArgs $ do
194194 getRouteWith validFullEncoder >>= \case
195195 Identity r -> case r of
196196 InL backendRoute :=> Identity a ->
197− runBackendConfigsT (_componentConfigs_backend configs) $
197+ runConfigsT (_componentConfigs_backend configs) $
198198 serveRoute $ backendRoute :/ a
199199 InR obeliskRoute :=> Identity a ->
200200 serveDefaultObeliskApp (mkRouteToUrl validFullEncoder) (serveStaticAssets defaultStaticAssets) frontend (_componentConfigs_frontend configs) $ obeliskRoute :/ a
@@ -208,7 +208,7 @@ renderGhcjsFrontend
208208 :: (MonadSnap m, HasCookies m)
209209 => (route -> Text)
210210 -> route
211− -> Map Text Text
211+ -> Map Text ByteString
212212 -> Frontend route
213213 -> m ByteString
214214renderGhcjsFrontend urlEnc route configs f = do
@@ -222,10 +222,10 @@ instance HasCookies Snap where
222222
223223getComponentConfigs :: IO ComponentConfigs
224224getComponentConfigs = do
225− allConfigs <- getConfigs
225+ allConfigs <- Lookup.getConfigs
226226 return $ ComponentConfigs
227227 { _componentConfigs_backend =
228− Map.filterWithKey (\k _ -> isMemberOf k ["common", "backend"]) allConfigs
228+ allConfigs
229229 , _componentConfigs_frontend =
230230 Map.filterWithKey (\k _ -> isMemberOf k ["common", "frontend"]) allConfigs
231231 }