summaryrefslogtreecommitdiff
path: root/server/Main.hs
diff options
context:
space:
mode:
authorstuebinm2022-02-16 00:14:41 +0100
committerstuebinm2022-02-16 00:14:41 +0100
commit2e51b4b237003bc969434c960b3c0fa3cf5317a4 (patch)
tree405863bdd488d1f3444ef8dcfeffe419680c1e09 /server/Main.hs
parent358305b196e41ca88155fd0d71516cefe7e2732d (diff)
… several hours of fighting with TOML later
WHO THOUGHT THIS SYNTAX WAS A GOOD IDEA?? (and who decided to write the least obvious combinator library to parse it?)
Diffstat (limited to '')
-rw-r--r--server/Main.hs28
1 files changed, 16 insertions, 12 deletions
diff --git a/server/Main.hs b/server/Main.hs
index fd66ad3..04a2010 100644
--- a/server/Main.hs
+++ b/server/Main.hs
@@ -17,8 +17,8 @@ import Cli.Extras (CliConfig,
import qualified Data.ByteString.Lazy.Char8 as C8
import Data.UUID (UUID)
import Handlers (App, adminOverviewImpl,
- relintImpl, statusImpl,
- submitImpl)
+ statusImpl,
+ )
import HtmlOrphans ()
import Network.Wai.Handler.Warp (defaultSettings,
runSettings, setPort)
@@ -42,14 +42,14 @@ import Server (AdminOverview,
Config (..), JobStatus,
RemoteRef (..),
ServerState,
- defaultState, loadConfig)
+ defaultState, loadConfig, verbose, port, orgs, Org (orgEntrypoint, orgRepos))
-- | Main API type
type API format =
- "submit" :> ReqBody '[JSON] RemoteRef :> Post '[format] UUID
- :<|> "status" :> Capture "jobid" UUID :> Get '[format] JobStatus
- :<|> "relint" :> Capture "jobid" UUID :> Get '[format] NoContent
+ -- "submit" :> ReqBody '[JSON] RemoteRef :> Post '[format] UUID
+ "status" :> Capture "jobid" UUID :> Get '[format] JobStatus
+ -- :<|> "relint" :> Capture "jobid" UUID :> Get '[format] NoContent
:<|> "admin" :> "overview" :> Get '[format] AdminOverview
type Routes =
@@ -61,9 +61,9 @@ type Routes =
-- | API's implementation
jsonAPI :: Config True -> MVar ServerState -> ServerT (API JSON) App
jsonAPI config state =
- submitImpl config state
- :<|> statusImpl state
- :<|> relintImpl config state
+ -- submitImpl config state
+ statusImpl state
+ -- :<|> relintImpl config state
:<|> adminOverviewImpl state
server :: Config True -> MVar ServerState -> ServerT Routes App
@@ -92,12 +92,16 @@ main = do
state <- newMVar defaultState
-- TODO: i really don't like all this cli logging stuff, replace it with
-- fast-logger at some point …
- cliconfig <- liftIO $ mkDefaultCliConfig ["-v" | verbose config]
+ cliconfig <- liftIO $ mkDefaultCliConfig ["-v" | view verbose config]
loggerMiddleware <- mkRequestLogger
- $ def { outputFormat = Detailed (verbose config) }
+ $ def { outputFormat = Detailed (view verbose config) }
+
+ -- print (keys $ view orgs config)
+ print (map orgEntrypoint $ view orgs config)
+ print (map orgRepos $ view orgs config)
let warpsettings =
- setPort (port config)
+ setPort (view port config)
defaultSettings
runSettings warpsettings