graphql-engine/server/src-lib/Hasura/Server/Version.hs
Vamshi Surabhi ec8b2c80b5
refactor to remove warnings especially with orphan instances (#1163)
* remove phase one/two distinction and hdbquery typeclass

* move extensions to default-extensions

* switch to LazyTx which only acquires a connection if needed

* move defns from TH module into Ops module

* remove tojson orphan instance for http exception

* remove orphan instance for dmlp1

* getTopLevelNodes will not throw any exceptions
2018-12-13 12:56:15 +05:30

31 lines
740 B
Haskell

module Hasura.Server.Version
( currentVersion
, consoleVersion
)
where
import Control.Lens ((^.))
import qualified Data.SemVer as V
import qualified Data.Text as T
import Hasura.Prelude
import Hasura.Server.Utils (runScript)
version :: T.Text
version = T.dropWhileEnd (== '\n') $(runScript "../scripts/get-version.sh")
consoleVersion :: T.Text
consoleVersion = case V.fromText $ T.dropWhile (== 'v') version of
Right ver -> mkVersion ver
Left _ -> version
mkVersion :: V.Version -> T.Text
mkVersion ver = T.pack $ "v" ++ show major ++ "." ++ show minor
where
major = ver ^. V.major
minor = ver ^. V.minor
currentVersion :: T.Text
currentVersion = version