From faf009aca16ba1e384fd5da2d6306d1379e36de3 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Thu, 13 Apr 2017 19:54:00 +0200 Subject: Support systemd.service notify type --- Application.hs | 8 ++++++-- bar.cabal | 3 ++- bar.nix | 12 ++++++------ 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/Application.hs b/Application.hs index aa9422f..46dc4c1 100644 --- a/Application.hs +++ b/Application.hs @@ -22,7 +22,8 @@ import Network.Wai (Middleware) import Network.Wai.Handler.Warp (Settings, defaultSettings, defaultShouldDisplayException, runSettings, setHost, - setOnException, setPort, getPort) + setOnException, setPort, getPort, + setBeforeMainLoop) import Network.Wai.Middleware.RequestLogger (Destination (Logger), IPAddrSource (..), OutputFormat (..), destination, @@ -45,6 +46,8 @@ import Handler.Types import Handler.List import Handler.InventoryList +import System.Systemd.Daemon + -- This line actually creates our YesodDispatch instance. It is the second half -- of the call to mkYesodData which occurs in Foundation.hs. Please see the -- comments there for more details. @@ -120,7 +123,8 @@ warpSettings foundation = "yesod" LevelError (toLogStr $ "Exception from Warp: " ++ show e)) - defaultSettings + $ setBeforeMainLoop (void notifyReady) + $ defaultSettings -- | For yesod devel, return the Warp settings and WAI Application. getApplicationDev :: IO (Settings, Application) diff --git a/bar.cabal b/bar.cabal index ffeb4be..c88457e 100644 --- a/bar.cabal +++ b/bar.cabal @@ -1,5 +1,5 @@ name: bar -version: 0.4.1 +version: 0.4.2 cabal-version: >= 1.8 build-type: Simple @@ -108,6 +108,7 @@ library , lens , thermoprint-client , hashids + , systemd executable bar if flag(library-only) diff --git a/bar.nix b/bar.nix index 53bbb10..1180260 100644 --- a/bar.nix +++ b/bar.nix @@ -3,14 +3,14 @@ , conduit, containers, data-default, directory, fast-logger , file-embed, hashids, hjsmin, http-conduit, lens, monad-control , monad-logger, mtl, persistent, persistent-postgresql -, persistent-template, safe, shakespeare, stdenv, template-haskell -, text, thermoprint-client, time, unordered-containers, vector, wai -, wai-extra, wai-logger, warp, yaml, yesod, yesod-auth, yesod-core -, yesod-form, yesod-static +, persistent-template, safe, shakespeare, stdenv, systemd +, template-haskell, text, thermoprint-client, time +, unordered-containers, vector, wai, wai-extra, wai-logger, warp +, yaml, yesod, yesod-auth, yesod-core, yesod-form, yesod-static }: mkDerivation { pname = "bar"; - version = "0.4.1"; + version = "0.4.2"; src = ./.; isLibrary = true; isExecutable = true; @@ -19,7 +19,7 @@ mkDerivation { classy-prelude-conduit classy-prelude-yesod conduit containers data-default directory fast-logger file-embed hashids hjsmin http-conduit lens monad-control monad-logger mtl persistent - persistent-postgresql persistent-template safe shakespeare + persistent-postgresql persistent-template safe shakespeare systemd template-haskell text thermoprint-client time unordered-containers vector wai wai-extra wai-logger warp yaml yesod yesod-auth yesod-core yesod-form yesod-static -- cgit v1.2.3