backends should work now (but untested)
This commit is contained in:
parent
e74ab26b44
commit
04d9f063d4
6 changed files with 113 additions and 11 deletions
14
README.md
14
README.md
|
@ -1 +1,15 @@
|
|||
# tickLeisteServer
|
||||
|
||||
You should enable at least one backend (else the application will terminate
|
||||
upon execution) this is done by setting a flag. The options are
|
||||
|
||||
http
|
||||
https
|
||||
fast-cgi
|
||||
cgi
|
||||
|
||||
fast-cgi depends on the fcgi C library, which should be installed on your system
|
||||
|
||||
TODO:
|
||||
can we use multiple backends at once?
|
||||
write configuration documentation.
|
||||
|
|
35
app/Main.hs
35
app/Main.hs
|
@ -7,11 +7,40 @@ module Main where
|
|||
-- TODO:
|
||||
-- We need some way too configure things, like the port we run on.
|
||||
-- see Network.Wai.Handler.Warp.Settings and Network.Wai.Handler.Warp.runSettings
|
||||
import WaiApp
|
||||
|
||||
import Control.Concurrent.MVar
|
||||
import Network.Wai.Handler.Warp
|
||||
import WaiApp
|
||||
|
||||
#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
|
||||
|
||||
main :: IO ()
|
||||
main = do
|
||||
serverState <- newMVar newServerState
|
||||
run 8080 $ waiApplication serverState
|
||||
#ifdef HTTP_SUPPORT
|
||||
HTTP.runSettings HTTP.defaultSettings $ waiApplication serverState
|
||||
#endif
|
||||
#ifdef HTTPS_SUPPORT
|
||||
HTTPS.runTLS HTTPS.defaultTlsSettings HTTP.defaultSettings $ waiApplication serverState
|
||||
#endif
|
||||
#ifdef FASTCGI_SUPPORT
|
||||
FastCGI.run $ waiApplication serverState
|
||||
#endif
|
||||
#ifdef CGI_SUPPORT
|
||||
CGI.run $ waiApplication serverState
|
||||
#endif
|
||||
return ()
|
||||
|
|
27
package.yaml
27
package.yaml
|
@ -29,7 +29,7 @@ flags:
|
|||
manual: true
|
||||
default: false
|
||||
fast-cgi:
|
||||
description: Build with fastcgi support
|
||||
description: Build with fastcgi support -- this depends on the fcgi c library
|
||||
manual: true
|
||||
default: false
|
||||
cgi:
|
||||
|
@ -49,12 +49,22 @@ dependencies:
|
|||
- containers
|
||||
- wai
|
||||
- wai-websockets
|
||||
- http-types
|
||||
|
||||
when:
|
||||
- condition: flag(http)
|
||||
dependencies:
|
||||
- http-types
|
||||
- warp
|
||||
- condition: flag(https)
|
||||
dependencies:
|
||||
- warp-tls
|
||||
- warp
|
||||
- condition: flag(fast-cgi)
|
||||
dependencies:
|
||||
- wai-handler-fastcgi
|
||||
- condition: flag(cgi)
|
||||
dependencies:
|
||||
wai-extra
|
||||
|
||||
build-tools:
|
||||
- cpphs
|
||||
|
@ -70,6 +80,19 @@ executables:
|
|||
- -cpp
|
||||
- -pgmP cpphs
|
||||
- -optP --cpp
|
||||
when:
|
||||
- condition: flag(http)
|
||||
cpp-options:
|
||||
- -DHTTP_SUPPORT
|
||||
- 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:
|
||||
|
|
|
@ -38,6 +38,7 @@ packages:
|
|||
extra-deps:
|
||||
- tickLeiste/tickLeiste
|
||||
- tickLeiste/tickLeiste-aeson
|
||||
- wai-handler-fastcgi-3.0.0.2@sha256:ecf5b5bd7e493b361df9099c190b6ca8f2fb5a467a2a5efa271b7f52d4d82986,1136
|
||||
# - acme-missiles-0.3
|
||||
# - git: https://github.com/commercialhaskell/stack.git
|
||||
# commit: e7b331f14bcffb8367cd58fbfc8b40ec7642100a
|
||||
|
|
|
@ -3,7 +3,14 @@
|
|||
# For more information, please see the documentation at:
|
||||
# https://docs.haskellstack.org/en/stable/lock_files
|
||||
|
||||
packages: []
|
||||
packages:
|
||||
- completed:
|
||||
hackage: wai-handler-fastcgi-3.0.0.2@sha256:ecf5b5bd7e493b361df9099c190b6ca8f2fb5a467a2a5efa271b7f52d4d82986,1136
|
||||
pantry-tree:
|
||||
size: 442
|
||||
sha256: d090422c36807ef5838f72fa74efcc211c528c5ba84e5a5114f6a3cf4ec685f4
|
||||
original:
|
||||
hackage: wai-handler-fastcgi-3.0.0.2@sha256:ecf5b5bd7e493b361df9099c190b6ca8f2fb5a467a2a5efa271b7f52d4d82986,1136
|
||||
snapshots:
|
||||
- completed:
|
||||
size: 532380
|
||||
|
|
|
@ -29,7 +29,7 @@ flag cgi
|
|||
default: False
|
||||
|
||||
flag fast-cgi
|
||||
description: Build with fastcgi support
|
||||
description: Build with fastcgi support -- this depends on the fcgi c library
|
||||
manual: True
|
||||
default: False
|
||||
|
||||
|
@ -59,6 +59,7 @@ executable tickLeisteServer
|
|||
, base >=4.7 && <5
|
||||
, bytestring
|
||||
, containers
|
||||
, http-types
|
||||
, text
|
||||
, tickLeiste
|
||||
, tickLeiste-aeson
|
||||
|
@ -68,8 +69,25 @@ executable tickLeisteServer
|
|||
, websockets
|
||||
if flag(http)
|
||||
build-depends:
|
||||
http-types
|
||||
, warp
|
||||
warp
|
||||
if flag(https)
|
||||
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
|
||||
|
@ -87,6 +105,7 @@ test-suite tickLeisteServer-test
|
|||
, base >=4.7 && <5
|
||||
, bytestring
|
||||
, containers
|
||||
, http-types
|
||||
, text
|
||||
, tickLeiste
|
||||
, tickLeiste-aeson
|
||||
|
@ -97,6 +116,15 @@ test-suite tickLeisteServer-test
|
|||
, websockets
|
||||
if flag(http)
|
||||
build-depends:
|
||||
http-types
|
||||
, warp
|
||||
warp
|
||||
if flag(https)
|
||||
build-depends:
|
||||
warp
|
||||
, warp-tls
|
||||
if flag(fast-cgi)
|
||||
build-depends:
|
||||
wai-handler-fastcgi
|
||||
if flag(cgi)
|
||||
build-depends:
|
||||
wai-extra
|
||||
default-language: Haskell2010
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue