mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-09-20 15:09:02 +03:00
server: add more info about server to config api (#3412)
Co-authored-by: Toan Nguyen <hgiasac@gmail.com> Co-authored-by: Vamshi Surabhi <0x777@users.noreply.github.com>
This commit is contained in:
parent
74b32fc9b8
commit
b2461c5899
@ -49,6 +49,11 @@ Sample response
|
||||
"jwt": {
|
||||
"claims_namespace": "https://hasura.io/jwt/claims",
|
||||
"claims_format": "json"
|
||||
},
|
||||
"is_allow_list_enabled": false,
|
||||
"live_queries": {
|
||||
"batch_size": 100,
|
||||
"refetch_delay": 1
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -96,7 +96,7 @@ module Hasura.GraphQL.Execute.LiveQuery
|
||||
, LiveQueryPlanExplanation
|
||||
, explainLiveQueryPlan
|
||||
|
||||
, LiveQueriesState
|
||||
, LiveQueriesState(..)
|
||||
, initLiveQueriesState
|
||||
, dumpLiveQueriesState
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
-- in "Hasura.GraphQL.Execute.LiveQuery.Poll". See "Hasura.GraphQL.Execute.LiveQuery" for high-level
|
||||
-- details.
|
||||
module Hasura.GraphQL.Execute.LiveQuery.State
|
||||
( LiveQueriesState
|
||||
( LiveQueriesState(..)
|
||||
, initLiveQueriesState
|
||||
, dumpLiveQueriesState
|
||||
|
||||
|
@ -580,7 +580,11 @@ httpApp corsCfg serverCtx enableConsole consoleAssetsDir enableTelemetry = do
|
||||
Spock.get "v1alpha1/config" $ spockAction encodeQErr id $
|
||||
mkGetHandler $ do
|
||||
onlyAdmin
|
||||
let res = encJFromJValue $ runGetConfig (scAuthMode serverCtx)
|
||||
let res = encJFromJValue $ runGetConfig
|
||||
(scAuthMode serverCtx)
|
||||
(scEnableAllowlist serverCtx)
|
||||
(EL._lqsOptions $ scLQState serverCtx)
|
||||
|
||||
return $ JSONResp $ HttpResponse res []
|
||||
|
||||
when enableGraphQL $ do
|
||||
|
@ -9,7 +9,9 @@ import Data.Aeson.TH
|
||||
import Hasura.Prelude
|
||||
import Hasura.Server.Auth
|
||||
import Hasura.Server.Auth.JWT
|
||||
import Hasura.Server.Version (HasVersion, Version, currentVersion)
|
||||
import Hasura.Server.Version (HasVersion, Version, currentVersion)
|
||||
|
||||
import qualified Hasura.GraphQL.Execute.LiveQuery.Options as LQ
|
||||
|
||||
data JWTInfo
|
||||
= JWTInfo
|
||||
@ -21,22 +23,27 @@ $(deriveToJSON (aesonDrop 4 snakeCase) ''JWTInfo)
|
||||
|
||||
data ServerConfig
|
||||
= ServerConfig
|
||||
{ scfgVersion :: !Version
|
||||
, scfgIsAdminSecretSet :: !Bool
|
||||
, scfgIsAuthHookSet :: !Bool
|
||||
, scfgIsJwtSet :: !Bool
|
||||
, scfgJwt :: !(Maybe JWTInfo)
|
||||
} deriving (Show)
|
||||
{ scfgVersion :: !Version
|
||||
, scfgIsAdminSecretSet :: !Bool
|
||||
, scfgIsAuthHookSet :: !Bool
|
||||
, scfgIsJwtSet :: !Bool
|
||||
, scfgJwt :: !(Maybe JWTInfo)
|
||||
, scfgIsAllowListEnabled :: !Bool
|
||||
, scfgLiveQueries :: !LQ.LiveQueriesOptions
|
||||
} deriving (Show, Eq)
|
||||
|
||||
$(deriveToJSON (aesonDrop 4 snakeCase) ''ServerConfig)
|
||||
|
||||
runGetConfig :: HasVersion => AuthMode -> ServerConfig
|
||||
runGetConfig am = ServerConfig
|
||||
currentVersion
|
||||
(isAdminSecretSet am)
|
||||
(isAuthHookSet am)
|
||||
(isJWTSet am)
|
||||
(getJWTInfo am)
|
||||
runGetConfig :: HasVersion => AuthMode -> Bool -> LQ.LiveQueriesOptions -> ServerConfig
|
||||
runGetConfig am isAllowListEnabled liveQueryOpts = ServerConfig
|
||||
currentVersion
|
||||
(isAdminSecretSet am)
|
||||
(isAuthHookSet am)
|
||||
(isJWTSet am)
|
||||
(getJWTInfo am)
|
||||
isAllowListEnabled
|
||||
liveQueryOpts
|
||||
|
||||
|
||||
isAdminSecretSet :: AuthMode -> Bool
|
||||
isAdminSecretSet = \case
|
||||
|
Loading…
Reference in New Issue
Block a user