diff options
Diffstat (limited to 'src/Settlr/Config.hs')
| -rw-r--r-- | src/Settlr/Config.hs | 17 |
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 |
