mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-17 12:31:52 +03:00
4929f83c71
https://github.com/hasura/graphql-engine-mono/pull/1682 GitOrigin-RevId: 6575f7bba20b75c48c5bc6d60e9379dc443aeaa0
17 lines
677 B
Haskell
17 lines
677 B
Haskell
module Hasura.Server.Version.TH (getVersionFromEnvironment) where
|
|
|
|
import Hasura.Prelude
|
|
|
|
import Hasura.Server.Utils (getValFromEnvOrScript)
|
|
import Hasura.Server.Version
|
|
|
|
import Data.FileEmbed (makeRelativeToProject)
|
|
import qualified Data.Text as T
|
|
import Data.Text.Conversions (FromText (..))
|
|
import qualified Language.Haskell.TH.Syntax as TH
|
|
|
|
getVersionFromEnvironment :: TH.Q (TH.TExp Version)
|
|
getVersionFromEnvironment = do
|
|
txt <- getValFromEnvOrScript "VERSION" <$> makeRelativeToProject "../scripts/get-version.sh"
|
|
[|| fromText $ T.dropWhileEnd (== '\n') $ T.pack $$(txt) ||]
|