Commit ed6b36ff authored by Christopher League's avatar Christopher League 🖥

Add /version route

parent 4dc0148f
...@@ -11,3 +11,4 @@ ...@@ -11,3 +11,4 @@
/book BookR GET POST /book BookR GET POST
/final FinalR GET /final FinalR GET
/clear ClearR GET /clear ClearR GET
/version VersionR GET
...@@ -21,6 +21,7 @@ module Handlers ...@@ -21,6 +21,7 @@ module Handlers
, postBookR , postBookR
, getFinalR , getFinalR
, getClearR , getClearR
, getVersionR
) where ) where
import qualified BookingForm as BF import qualified BookingForm as BF
...@@ -28,6 +29,7 @@ import Calendar ...@@ -28,6 +29,7 @@ import Calendar
import Control.Monad.Trans.Maybe import Control.Monad.Trans.Maybe
import Data.FileEmbed (embedFile) import Data.FileEmbed (embedFile)
import qualified Data.SortedList as SL import qualified Data.SortedList as SL
import Development.GitRev
import Data.Time.Zones (localTimeToUTCTZ, utcToLocalTimeTZ) import Data.Time.Zones (localTimeToUTCTZ, utcToLocalTimeTZ)
import qualified FreshCache as FC import qualified FreshCache as FC
import Import import Import
...@@ -138,3 +140,7 @@ getFaviconR = do ...@@ -138,3 +140,7 @@ getFaviconR = do
getRobotsR :: Handler TypedContent getRobotsR :: Handler TypedContent
getRobotsR = getRobotsR =
return $ TypedContent typePlain $ toContent $(embedFile "config/robots.txt") return $ TypedContent typePlain $ toContent $(embedFile "config/robots.txt")
getVersionR :: Handler Text
getVersionR =
return $ $(gitHash) <> if $(gitDirty) then "+" else ""
...@@ -40,7 +40,6 @@ import Data.Time.Zones (TZ) ...@@ -40,7 +40,6 @@ import Data.Time.Zones (TZ)
import Data.Time.Zones.All (TZLabel, fromTZName, toTZName) import Data.Time.Zones.All (TZLabel, fromTZName, toTZName)
import qualified Data.Time.Zones.All as TZ import qualified Data.Time.Zones.All as TZ
import Data.Yaml (decodeEither') import Data.Yaml (decodeEither')
import Development.GitRev
import Language.Haskell.TH.Syntax (Exp, Name, Q) import Language.Haskell.TH.Syntax (Exp, Name, Q)
import Network.Wai.Handler.Warp (HostPreference) import Network.Wai.Handler.Warp (HostPreference)
import Yesod.Default.Config2 (applyEnvValue, configSettingsYml) import Yesod.Default.Config2 (applyEnvValue, configSettingsYml)
...@@ -222,13 +221,3 @@ varGoogleSecret = "BOOKME_GOOGLE_SECRET" ...@@ -222,13 +221,3 @@ varGoogleSecret = "BOOKME_GOOGLE_SECRET"
-- | Environment variable used for Google refresh token. -- | Environment variable used for Google refresh token.
varGoogleRefreshToken :: IsString s => s varGoogleRefreshToken :: IsString s => s
varGoogleRefreshToken = "BOOKME_GOOGLE_REFRESH" varGoogleRefreshToken = "BOOKME_GOOGLE_REFRESH"
showGit :: IO ()
showGit = do
say $ "gitBranch = " <> tshow $(gitBranch)
say $ "gitCommitCount = " <> tshow $(gitCommitCount)
say $ "gitCommitDate = " <> tshow $(gitCommitDate)
say $ "gitDescribe = " <> tshow $(gitDescribe)
say $ "gitDirty = " <> tshow $(gitDirty)
say $ "gitDirtyTracked = " <> tshow $(gitDirtyTracked)
say $ "gitHash = " <> tshow $(gitHash)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment