diff --git a/app/Backend/Backend.hs b/app/Backend/Backend.hs index 6ad5202..5f988ff 100644 --- a/app/Backend/Backend.hs +++ b/app/Backend/Backend.hs @@ -1,5 +1,6 @@ +{-# LANGUAGE CPP #-} module Backend.Backend where - + import Control.Concurrent.MVar import qualified Network.Wai as Wai @@ -9,12 +10,6 @@ import qualified Backend.Http as HTTP #ifdef HTTPS_SUPPORT import qualified Backend.Https as HTTPS #endif -#ifdef FASTCGI_SUPPORT -import qualified Backend.FastCGI as FASTCGI -#endif -#ifdef CGI_SUPPORT -import qualified Backend.CGI as CGI -#endif -- maybe we want a String instead of T.Text depends on -- the argument parser @@ -40,11 +35,5 @@ backends = #endif #ifdef HTTPS_SUPPORT BackendWithConfig HTTPS.forkHttpsBackend "https" "Host as as simple https server, using Warp" : -#endif -#ifdef FASTCGI_SUPPORT - BackendWithoutConfig FASTCGI.forkFastCGIBackend "fastcgi" "Deploy with fastcgi" : -#endif -#ifdef CGI_SUPPORT - BackendWithoutConfig CGI.forkCGIBackend "cgi" "Deploy with cgi" : #endif [] diff --git a/app/Backend/CGI.hs b/app/Backend/CGI.hs deleted file mode 100644 index 3e90cc1..0000000 --- a/app/Backend/CGI.hs +++ /dev/null @@ -1,12 +0,0 @@ -module Backend.CGI(forkCGIBackend) where - -import Config -import qualified Network.Wai as Wai -import qualified Network.Wai.Handler.CGI as CGI -import Control.Concurrent.MVar - -forkCGIBackend :: Wai.Application -> IO [MVar ()] -forkCGIBackend = fmap (: []) . forkBackend . CGI.run - - - diff --git a/app/Backend/FastCGI.hs b/app/Backend/FastCGI.hs deleted file mode 100644 index 28b2ea1..0000000 --- a/app/Backend/FastCGI.hs +++ /dev/null @@ -1,9 +0,0 @@ -module Backend.FastCGI where - -import Config -import qualified Network.Wai as Wai -import qualified Network.Wai.Handler.FastCGI as Fcgi -import Control.Concurrent.MVar - -forkFastCGIBackend :: Wai.Application -> IO [MVar ()] -forkFastCGIBackend = fmap (: []) . forkBackend . Fcgi.run diff --git a/app/Backend/Http.hs b/app/Backend/Http.hs index 3bedc98..e448f27 100644 --- a/app/Backend/Http.hs +++ b/app/Backend/Http.hs @@ -1,3 +1,11 @@ +{-# LANGUAGE CPP #-} +#ifndef HTTP_SUPPORT +module Backend.Http +where + +#endif + +#ifdef HTTP_SUPPORT {-# LANGUAGE OverloadedStrings #-} -- we export a bit more than we have to, because the https module can reuse these things. @@ -78,3 +86,4 @@ httpToWarpConfig config' = HTTP.setPort confPort $ HTTP.setHost (fromString conf backend :: Wai.Application -> HttpConfiguration -> IO () backend app config = HTTP.runSettings (httpToWarpConfig config) app +#endif diff --git a/app/Backend/Https.hs b/app/Backend/Https.hs index 559d88f..51cfba2 100644 --- a/app/Backend/Https.hs +++ b/app/Backend/Https.hs @@ -1,3 +1,9 @@ +{-# LANGUAGE CPP #-} +#ifndef HTTPS_SUPPORT +module Backend.Https +where + +#else {-# LANGUAGE OverloadedStrings #-} module Backend.Https (forkHttpsBackend, httpsDefaultSettings) where @@ -74,3 +80,4 @@ httpsToWarpConfig = httpToWarpConfig . fst backend :: Wai.Application -> HttpsConfiguration -> IO () backend app conf = HTTPS.runTLS (httpsToWarpTLSConfig conf) (httpsToWarpConfig conf) app +#endif diff --git a/app/Main.hs b/app/Main.hs index e62bd02..2c851ba 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -15,23 +15,6 @@ import Control.Concurrent import Backend.Backend import Options.Applicative -#ifdef HTTP_SUPPORT -import qualified Network.Wai.Handler.Warp as HTTP -#endif - -#ifdef HTTPS_SUPPORT -import qualified Network.Wai.Handler.WarpTLS as HTTPS -import qualified Network.Wai.Handler.Warp as HTTP -#endif - -#ifdef FASTCGI_SUPPORT -import qualified Network.Wai.Handler.FastCGI as FastCGI -#endif - -#ifdef CGI_SUPPORT -import qualified Network.Wai.Handler.CGI as CGI -#endif - -- maybe we should use Control.Concurrent.ParallelIO but right -- now we just rely that the backends fork and don't block main :: IO () diff --git a/package.yaml b/package.yaml index 9d3610e..379b4af 100644 --- a/package.yaml +++ b/package.yaml @@ -28,14 +28,6 @@ flags: description: Build with https support manual: true default: true - fast-cgi: - description: Build with fastcgi support -- this depends on the fcgi c library - manual: true - default: true - cgi: - description: Build with cgi support - manual: true - default: true dependencies: - base >= 4.7 && < 5 @@ -62,15 +54,6 @@ when: dependencies: - warp-tls - warp - - condition: flag(fast-cgi) - dependencies: - - wai-handler-fastcgi - - condition: flag(cgi) - dependencies: - wai-extra - -build-tools: -- cpphs executables: tickLeisteServer: @@ -80,9 +63,6 @@ executables: - -threaded - -rtsopts - -with-rtsopts=-N - - -cpp - - -pgmP cpphs - - -optP --cpp when: - condition: flag(http) cpp-options: @@ -90,12 +70,6 @@ executables: - condition: flag(https) cpp-options: - -DHTTPS_SUPPORT - - condition: flag(fast-cgi) - cpp-options: - - -DFASTCGI_SUPPORT - - condition: flag(cgi) - cpp-options: - - -DCGI_SUPPORT tests: tickLeisteServer-test: diff --git a/stack.yaml b/stack.yaml index 41e6e92..96a2c33 100644 --- a/stack.yaml +++ b/stack.yaml @@ -52,9 +52,7 @@ extra-deps: flags: tickLeisteServer: http: true - https: true - fast-cgi: true - cgi: true + https: false # Extra package databases containing global packages # extra-package-dbs: [] diff --git a/tickLeisteServer.cabal b/tickLeisteServer.cabal index b948254..83beec8 100644 --- a/tickLeisteServer.cabal +++ b/tickLeisteServer.cabal @@ -23,16 +23,6 @@ source-repository head type: git location: https://github.com/githubuser/tickLeisteServer -flag cgi - description: Build with cgi support - manual: True - default: True - -flag fast-cgi - description: Build with fastcgi support -- this depends on the fcgi c library - manual: True - default: True - flag http description: Build with http support manual: True @@ -47,8 +37,6 @@ executable tickLeisteServer main-is: Main.hs other-modules: Backend.Backend - Backend.CGI - Backend.FastCGI Backend.Http Backend.Https Config @@ -57,9 +45,7 @@ executable tickLeisteServer Paths_tickLeisteServer hs-source-dirs: app - ghc-options: -threaded -rtsopts -with-rtsopts=-N -cpp -pgmP cpphs -optP --cpp - build-tools: - cpphs + ghc-options: -threaded -rtsopts -with-rtsopts=-N build-depends: aeson , base >=4.7 && <5 @@ -83,20 +69,10 @@ executable tickLeisteServer build-depends: warp , warp-tls - if flag(fast-cgi) - build-depends: - wai-handler-fastcgi - if flag(cgi) - build-depends: - wai-extra if flag(http) cpp-options: -DHTTP_SUPPORT if flag(https) cpp-options: -DHTTPS_SUPPORT - if flag(fast-cgi) - cpp-options: -DFASTCGI_SUPPORT - if flag(cgi) - cpp-options: -DCGI_SUPPORT default-language: Haskell2010 test-suite tickLeisteServer-test @@ -107,8 +83,6 @@ test-suite tickLeisteServer-test hs-source-dirs: test ghc-options: -threaded -rtsopts -with-rtsopts=-N - build-tools: - cpphs build-depends: aeson , base >=4.7 && <5 @@ -133,10 +107,4 @@ test-suite tickLeisteServer-test build-depends: warp , warp-tls - if flag(fast-cgi) - build-depends: - wai-handler-fastcgi - if flag(cgi) - build-depends: - wai-extra default-language: Haskell2010