summaryrefslogtreecommitdiff
path: root/src/Settlr/Config.hs
diff options
context:
space:
mode:
authorHannes Schulze <contact@haschu.me>2026-10-04 03:38:43 +0200
committerHannes Schulze <contact@haschu.me>2026-10-04 03:38:43 +0200
commit38cb6b48653f950092e6cd6cd2332eec3f77e667 (patch)
treea7b6286f01c166ed7f25cd06d53f6811c5022a6a /src/Settlr/Config.hs
parent41dc555f3a4d53a8773a03ac24bed9aea8143bfa (diff)
persistence api
Diffstat (limited to 'src/Settlr/Config.hs')
-rw-r--r--src/Settlr/Config.hs17
1 files changed, 2 insertions, 15 deletions
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