From 38cb6b48653f950092e6cd6cd2332eec3f77e667 Mon Sep 17 00:00:00 2001 From: Hannes Schulze Date: Sun, 4 Oct 2026 03:38:43 +0200 Subject: persistence api --- src/Settlr/Config.hs | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) (limited to 'src/Settlr/Config.hs') diff --git a/src/Settlr/Config.hs b/src/Settlr/Config.hs index 1e2ff09..2987f8c 100644 --- a/src/Settlr/Config.hs +++ b/src/Settlr/Config.hs @@ -2,27 +2,17 @@ {-# LANGUAGE TypeSynonymInstances #-} {-# LANGUAGE FlexibleInstances #-} module Settlr.Config - ( ScriptM - , Config(..) + ( Config(..) , ConfigException(..) , loadConfig - , withConfig ) where import Data.Text (Text) import qualified Data.Text as T -import Network.CGI (getVarWithDefault, getVar, scriptName, CGIT, CGI) +import Network.CGI (getVarWithDefault, getVar, scriptName) import Control.Exception (Exception) import Control.Monad.Catch (MonadThrow, throwM) -import Control.Monad.Reader (ReaderT(runReaderT)) import Network.CGI.Monad (MonadCGI(..)) -import Control.Monad.Trans (lift) - -type ScriptM = ReaderT Config (CGIT IO) - -instance MonadCGI ScriptM where - cgiAddHeader x y = lift $ cgiAddHeader x y - cgiGet x = lift $ cgiGet x data Config = Config { cfgCssPath :: !Text -- ^ $SETTLR_CSS_PATH, defaults to "/settlr.css" @@ -49,6 +39,3 @@ loadConfig = do cssPath <- getVarWithDefault "SETTLR_CSS_PATH" "/settlr.css" , cfgScriptPath = T.pack scriptPath , cfgDataPath = T.pack dataPath } - -withConfig :: ScriptM a -> CGI a -withConfig x = loadConfig >>= runReaderT x -- cgit v1.3.1