summaryrefslogtreecommitdiff
path: root/server/Serverconfig.hs
diff options
context:
space:
mode:
authorstuebinm2022-02-07 16:05:55 +0100
committerstuebinm2022-02-07 16:05:55 +0100
commitf429cbc0d56dc8426285bc2d5ca7301ec241da98 (patch)
tree2505368b5c78d95cbfe0c22781be9a47974bc987 /server/Serverconfig.hs
parent2ce9a23fe7de72f4c8bf33a8c26f555cf08f8715 (diff)
non-blocking server
Diffstat (limited to 'server/Serverconfig.hs')
-rw-r--r--server/Serverconfig.hs45
1 files changed, 0 insertions, 45 deletions
diff --git a/server/Serverconfig.hs b/server/Serverconfig.hs
deleted file mode 100644
index d919567..0000000
--- a/server/Serverconfig.hs
+++ /dev/null
@@ -1,45 +0,0 @@
-{-# LANGUAGE DataKinds #-}
-{-# LANGUAGE DeriveAnyClass #-}
-{-# LANGUAGE DeriveGeneric #-}
-{-# LANGUAGE KindSignatures #-}
-{-# LANGUAGE RankNTypes #-}
-{-# LANGUAGE ScopedTypeVariables #-}
-{-# LANGUAGE TypeApplications #-}
-{-# LANGUAGE TypeFamilies #-}
-{-# LANGUAGE TypeOperators #-}
-
-module Serverconfig (loadConfig, Config(..), RemoteRef(..)) where
-
-import Data.Aeson (FromJSON, eitherDecode)
-import qualified Data.ByteString.Lazy as LB
-import Data.Text (Text)
-import GHC.Generics (Generic)
-import LintConfig (LintConfig')
-
--- | a reference in a remote git repository
-data RemoteRef = RemoteRef
- { repourl :: Text
- , reporef :: Text
- } deriving (Generic, FromJSON)
-
-type family ConfigRes (b :: Bool) a where
- ConfigRes True a = a
- ConfigRes False a = FilePath
-
--- | the server's configuration
-data Config l = Config
- { tmpdir :: FilePath
- -- ^ dir to clone git things in
- , port :: Int
- -- ^ port to bind to
- , entrypoint :: FilePath
- , lintconfig :: ConfigRes l LintConfig'
- }
-
-loadConfig :: Config False -> IO (Config True)
-loadConfig config = do
- loaded <- LB.readFile (lintconfig config) >>= \res ->
- case eitherDecode res :: Either String LintConfig' of
- Left err -> error $ "config file invalid: " <> err
- Right file -> pure file
- pure $ config { lintconfig = loaded }