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
|
# 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:
|
-- TODO:
|
||||||
-- We need some way too configure things, like the port we run on.
|
-- 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
|
-- see Network.Wai.Handler.Warp.Settings and Network.Wai.Handler.Warp.runSettings
|
||||||
import WaiApp
|
|
||||||
import Control.Concurrent.MVar
|
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 :: IO ()
|
||||||
main = do
|
main = do
|
||||||
serverState <- newMVar newServerState
|
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
|
manual: true
|
||||||
default: false
|
default: false
|
||||||
fast-cgi:
|
fast-cgi:
|
||||||
description: Build with fastcgi support
|
description: Build with fastcgi support -- this depends on the fcgi c library
|
||||||
manual: true
|
manual: true
|
||||||
default: false
|
default: false
|
||||||
cgi:
|
cgi:
|
||||||
|
@ -49,12 +49,22 @@ dependencies:
|
||||||
- containers
|
- containers
|
||||||
- wai
|
- wai
|
||||||
- wai-websockets
|
- wai-websockets
|
||||||
|
- http-types
|
||||||
|
|
||||||
when:
|
when:
|
||||||
- condition: flag(http)
|
- condition: flag(http)
|
||||||
dependencies:
|
dependencies:
|
||||||
- http-types
|
|
||||||
- warp
|
- warp
|
||||||
|
- condition: flag(https)
|
||||||
|
dependencies:
|
||||||
|
- warp-tls
|
||||||
|
- warp
|
||||||
|
- condition: flag(fast-cgi)
|
||||||
|
dependencies:
|
||||||
|
- wai-handler-fastcgi
|
||||||
|
- condition: flag(cgi)
|
||||||
|
dependencies:
|
||||||
|
wai-extra
|
||||||
|
|
||||||
build-tools:
|
build-tools:
|
||||||
- cpphs
|
- cpphs
|
||||||
|
@ -70,6 +80,19 @@ executables:
|
||||||
- -cpp
|
- -cpp
|
||||||
- -pgmP cpphs
|
- -pgmP cpphs
|
||||||
- -optP --cpp
|
- -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:
|
tests:
|
||||||
tickLeisteServer-test:
|
tickLeisteServer-test:
|
||||||
|
|
|
@ -38,6 +38,7 @@ packages:
|
||||||
extra-deps:
|
extra-deps:
|
||||||
- tickLeiste/tickLeiste
|
- tickLeiste/tickLeiste
|
||||||
- tickLeiste/tickLeiste-aeson
|
- tickLeiste/tickLeiste-aeson
|
||||||
|
- wai-handler-fastcgi-3.0.0.2@sha256:ecf5b5bd7e493b361df9099c190b6ca8f2fb5a467a2a5efa271b7f52d4d82986,1136
|
||||||
# - acme-missiles-0.3
|
# - acme-missiles-0.3
|
||||||
# - git: https://github.com/commercialhaskell/stack.git
|
# - git: https://github.com/commercialhaskell/stack.git
|
||||||
# commit: e7b331f14bcffb8367cd58fbfc8b40ec7642100a
|
# commit: e7b331f14bcffb8367cd58fbfc8b40ec7642100a
|
||||||
|
|
|
@ -3,7 +3,14 @@
|
||||||
# For more information, please see the documentation at:
|
# For more information, please see the documentation at:
|
||||||
# https://docs.haskellstack.org/en/stable/lock_files
|
# 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:
|
snapshots:
|
||||||
- completed:
|
- completed:
|
||||||
size: 532380
|
size: 532380
|
||||||
|
|
|
@ -29,7 +29,7 @@ flag cgi
|
||||||
default: False
|
default: False
|
||||||
|
|
||||||
flag fast-cgi
|
flag fast-cgi
|
||||||
description: Build with fastcgi support
|
description: Build with fastcgi support -- this depends on the fcgi c library
|
||||||
manual: True
|
manual: True
|
||||||
default: False
|
default: False
|
||||||
|
|
||||||
|
@ -59,6 +59,7 @@ executable tickLeisteServer
|
||||||
, base >=4.7 && <5
|
, base >=4.7 && <5
|
||||||
, bytestring
|
, bytestring
|
||||||
, containers
|
, containers
|
||||||
|
, http-types
|
||||||
, text
|
, text
|
||||||
, tickLeiste
|
, tickLeiste
|
||||||
, tickLeiste-aeson
|
, tickLeiste-aeson
|
||||||
|
@ -68,8 +69,25 @@ executable tickLeisteServer
|
||||||
, websockets
|
, websockets
|
||||||
if flag(http)
|
if flag(http)
|
||||||
build-depends:
|
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
|
default-language: Haskell2010
|
||||||
|
|
||||||
test-suite tickLeisteServer-test
|
test-suite tickLeisteServer-test
|
||||||
|
@ -87,6 +105,7 @@ test-suite tickLeisteServer-test
|
||||||
, base >=4.7 && <5
|
, base >=4.7 && <5
|
||||||
, bytestring
|
, bytestring
|
||||||
, containers
|
, containers
|
||||||
|
, http-types
|
||||||
, text
|
, text
|
||||||
, tickLeiste
|
, tickLeiste
|
||||||
, tickLeiste-aeson
|
, tickLeiste-aeson
|
||||||
|
@ -97,6 +116,15 @@ test-suite tickLeisteServer-test
|
||||||
, websockets
|
, websockets
|
||||||
if flag(http)
|
if flag(http)
|
||||||
build-depends:
|
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
|
default-language: Haskell2010
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue