{-# LANGUAGE Arrows #-}
module Hasura.App.State
(
RebuildableAppContext (..),
AppEnv (..),
AppContext (..),
Loggers (..),
HasAppEnv (..),
buildRebuildableAppContext,
rebuildRebuildableAppContext,
initSQLGenCtx,
buildCacheStaticConfig,
buildCacheDynamicConfig,
)
where
import Control.Arrow.Extended
import Control.Concurrent.STM qualified as STM
import Control.Monad.Trans.Control (MonadBaseControl)
import Data.Environment qualified as E
import Data.HashSet qualified as Set
import Database.PG.Query qualified as PG
import Hasura.Backends.DataConnector.Agent.Client (AgentLicenseKey)
import Hasura.Base.Error
import Hasura.CredentialCache
import Hasura.Eventing.Common (LockedEventsCtx)
import Hasura.Eventing.EventTrigger
import Hasura.GraphQL.Execute.Subscription.Options
import Hasura.GraphQL.Execute.Subscription.State qualified as ES
import Hasura.Incremental qualified as Inc
import Hasura.Logging qualified as L
import Hasura.Prelude
import Hasura.RQL.DDL.Schema.Cache.Config
import Hasura.RQL.Types.BackendType
import Hasura.RQL.Types.Common
import Hasura.RQL.Types.Metadata
import Hasura.RQL.Types.NamingCase
import Hasura.RQL.Types.Roles (RoleName)
import Hasura.RQL.Types.Schema.Options qualified as Options
import Hasura.RQL.Types.SchemaCache (MetadataResourceVersion)
import Hasura.Server.Auth
import Hasura.Server.Cors qualified as Cors
import Hasura.Server.Init
import Hasura.Server.Logging
import Hasura.Server.Metrics
import Hasura.Server.Prometheus
import Hasura.Server.Types
import Hasura.ShutdownLatch
import Hasura.Tracing qualified as Tracing
import Network.HTTP.Client qualified as HTTP
import Network.Wai.Handler.Warp (HostPreference)
import Network.WebSockets.Connection qualified as WebSockets
import Refined (NonNegative, Refined)
data RebuildableAppContext impl = RebuildableAppContext
{ forall impl. RebuildableAppContext impl -> AppContext
lastBuiltAppContext :: AppContext,
forall impl. RebuildableAppContext impl -> InvalidationKeys
_racInvalidationMap :: InvalidationKeys,
forall impl.
RebuildableAppContext impl
-> Rule
(ReaderT (Logger Hasura, Manager) (ExceptT QErr IO))
(ServeOptions impl, Environment, InvalidationKeys)
AppContext
_racRebuild :: Inc.Rule (ReaderT (L.Logger L.Hasura, HTTP.Manager) (ExceptT QErr IO)) (ServeOptions impl, E.Environment, InvalidationKeys) AppContext
}
data AppEnv = AppEnv
{ AppEnv -> Port
appEnvPort :: Port,
AppEnv -> HostPreference
appEnvHost :: HostPreference,
AppEnv -> PGPool
appEnvMetadataDbPool :: PG.PGPool,
AppEnv -> Maybe PGPool
appEnvIntrospectionDbPool :: Maybe PG.PGPool,
AppEnv -> Manager
appEnvManager :: HTTP.Manager,
AppEnv -> Loggers
appEnvLoggers :: Loggers,
AppEnv -> TMVar MetadataResourceVersion
appEnvMetadataVersionRef :: STM.TMVar MetadataResourceVersion,
AppEnv -> InstanceId
appEnvInstanceId :: InstanceId,
AppEnv -> MaintenanceMode ()
appEnvEnableMaintenanceMode :: MaintenanceMode (),
AppEnv -> LoggingSettings
appEnvLoggingSettings :: LoggingSettings,
AppEnv -> EventingMode
appEnvEventingMode :: EventingMode,
AppEnv -> ReadOnlyMode
appEnvEnableReadOnlyMode :: ReadOnlyMode,
AppEnv -> ServerMetrics
appEnvServerMetrics :: ServerMetrics,
AppEnv -> ShutdownLatch
appEnvShutdownLatch :: ShutdownLatch,
AppEnv -> TMVar MetadataResourceVersion
appEnvMetaVersionRef :: STM.TMVar MetadataResourceVersion,
AppEnv -> PrometheusMetrics
appEnvPrometheusMetrics :: PrometheusMetrics,
AppEnv -> SamplingPolicy
appEnvTraceSamplingPolicy :: Tracing.SamplingPolicy,
AppEnv -> SubscriptionsState
appEnvSubscriptionState :: ES.SubscriptionsState,
AppEnv -> LockedEventsCtx
appEnvLockedEventsCtx :: LockedEventsCtx,
AppEnv -> ConnParams
appEnvConnParams :: PG.ConnParams,
AppEnv -> TxIsolation
appEnvTxIso :: PG.TxIsolation,
AppEnv -> Maybe Text
appEnvConsoleAssetsDir :: Maybe Text,
AppEnv -> Maybe Text
appEnvConsoleSentryDsn :: Maybe Text,
AppEnv -> ConnectionOptions
appEnvConnectionOptions :: WebSockets.ConnectionOptions,
AppEnv -> KeepAliveDelay
appEnvWebSocketKeepAlive :: KeepAliveDelay,
AppEnv -> WSConnectionInitTimeout
appEnvWebSocketConnectionInitTimeout :: WSConnectionInitTimeout,
AppEnv -> Refined NonNegative Seconds
appEnvGracefulShutdownTimeout :: Refined NonNegative Seconds,
AppEnv -> OptionalInterval
appEnvSchemaPollInterval :: OptionalInterval,
AppEnv -> CheckFeatureFlag
appEnvCheckFeatureFlag :: CheckFeatureFlag,
AppEnv -> Maybe (CredentialCache AgentLicenseKey)
appEnvLicenseKeyCache :: Maybe (CredentialCache AgentLicenseKey),
:: Int
}
data AppContext = AppContext
{ AppContext -> AuthMode
acAuthMode :: AuthMode,
AppContext -> SQLGenCtx
acSQLGenCtx :: SQLGenCtx,
AppContext -> HashSet API
acEnabledAPIs :: Set.HashSet API,
AppContext -> AllowListStatus
acEnableAllowlist :: AllowListStatus,
AppContext -> ResponseInternalErrorsConfig
acResponseInternalErrorsConfig :: ResponseInternalErrorsConfig,
AppContext -> Environment
acEnvironment :: E.Environment,
AppContext -> RemoteSchemaPermissions
acRemoteSchemaPermsCtx :: Options.RemoteSchemaPermissions,
AppContext -> InferFunctionPermissions
acFunctionPermsCtx :: Options.InferFunctionPermissions,
AppContext -> HashSet ExperimentalFeature
acExperimentalFeatures :: Set.HashSet ExperimentalFeature,
AppContext -> NamingCase
acDefaultNamingConvention :: NamingCase,
AppContext -> MetadataDefaults
acMetadataDefaults :: MetadataDefaults,
AppContext -> LiveQueriesOptions
acLiveQueryOptions :: LiveQueriesOptions,
AppContext -> LiveQueriesOptions
acStreamQueryOptions :: StreamQueriesOptions,
AppContext -> CorsPolicy
acCorsPolicy :: Cors.CorsPolicy,
AppContext -> ConsoleStatus
acConsoleStatus :: ConsoleStatus,
AppContext -> TelemetryStatus
acEnableTelemetry :: TelemetryStatus,
AppContext -> EventEngineCtx
acEventEngineCtx :: EventEngineCtx,
AppContext -> OptionalInterval
acAsyncActionsFetchInterval :: OptionalInterval,
AppContext -> ApolloFederationStatus
acApolloFederationStatus :: ApolloFederationStatus,
AppContext -> CloseWebsocketsOnMetadataChangeStatus
acCloseWebsocketsOnMetadataChangeStatus :: CloseWebsocketsOnMetadataChangeStatus
}
data Loggers = Loggers
{ Loggers -> LoggerCtx Hasura
_lsLoggerCtx :: L.LoggerCtx L.Hasura,
Loggers -> Logger Hasura
_lsLogger :: L.Logger L.Hasura,
Loggers -> PGLogger
_lsPgLogger :: PG.PGLogger
}
data InvalidationKeys = InvalidationKeys
class (Monad m) => HasAppEnv m where
askAppEnv :: m AppEnv
instance (HasAppEnv m) => HasAppEnv (ReaderT r m) where
askAppEnv :: ReaderT r m AppEnv
askAppEnv = m AppEnv -> ReaderT r m AppEnv
forall (m :: * -> *) a. Monad m => m a -> ReaderT r m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift m AppEnv
forall (m :: * -> *). HasAppEnv m => m AppEnv
askAppEnv
instance (HasAppEnv m) => HasAppEnv (ExceptT e m) where
askAppEnv :: ExceptT e m AppEnv
askAppEnv = m AppEnv -> ExceptT e m AppEnv
forall (m :: * -> *) a. Monad m => m a -> ExceptT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift m AppEnv
forall (m :: * -> *). HasAppEnv m => m AppEnv
askAppEnv
initInvalidationKeys :: InvalidationKeys
initInvalidationKeys :: InvalidationKeys
initInvalidationKeys = InvalidationKeys
InvalidationKeys
buildRebuildableAppContext :: (L.Logger L.Hasura, HTTP.Manager) -> ServeOptions impl -> E.Environment -> ExceptT QErr IO (RebuildableAppContext impl)
buildRebuildableAppContext :: forall impl.
(Logger Hasura, Manager)
-> ServeOptions impl
-> Environment
-> ExceptT QErr IO (RebuildableAppContext impl)
buildRebuildableAppContext (Logger Hasura, Manager)
readerContext ServeOptions impl
serveOptions Environment
env = do
Result
(ReaderT (Logger Hasura, Manager) (ExceptT QErr IO))
(ServeOptions impl, Environment, InvalidationKeys)
AppContext
result <- (ReaderT
(Logger Hasura, Manager)
(ExceptT QErr IO)
(Result
(ReaderT (Logger Hasura, Manager) (ExceptT QErr IO))
(ServeOptions impl, Environment, InvalidationKeys)
AppContext)
-> (Logger Hasura, Manager)
-> ExceptT
QErr
IO
(Result
(ReaderT (Logger Hasura, Manager) (ExceptT QErr IO))
(ServeOptions impl, Environment, InvalidationKeys)
AppContext))
-> (Logger Hasura, Manager)
-> ReaderT
(Logger Hasura, Manager)
(ExceptT QErr IO)
(Result
(ReaderT (Logger Hasura, Manager) (ExceptT QErr IO))
(ServeOptions impl, Environment, InvalidationKeys)
AppContext)
-> ExceptT
QErr
IO
(Result
(ReaderT (Logger Hasura, Manager) (ExceptT QErr IO))
(ServeOptions impl, Environment, InvalidationKeys)
AppContext)
forall a b c. (a -> b -> c) -> b -> a -> c
flip ReaderT
(Logger Hasura, Manager)
(ExceptT QErr IO)
(Result
(ReaderT (Logger Hasura, Manager) (ExceptT QErr IO))
(ServeOptions impl, Environment, InvalidationKeys)
AppContext)
-> (Logger Hasura, Manager)
-> ExceptT
QErr
IO
(Result
(ReaderT (Logger Hasura, Manager) (ExceptT QErr IO))
(ServeOptions impl, Environment, InvalidationKeys)
AppContext)
forall r (m :: * -> *) a. ReaderT r m a -> r -> m a
runReaderT (Logger Hasura, Manager)
readerContext (ReaderT
(Logger Hasura, Manager)
(ExceptT QErr IO)
(Result
(ReaderT (Logger Hasura, Manager) (ExceptT QErr IO))
(ServeOptions impl, Environment, InvalidationKeys)
AppContext)
-> ExceptT
QErr
IO
(Result
(ReaderT (Logger Hasura, Manager) (ExceptT QErr IO))
(ServeOptions impl, Environment, InvalidationKeys)
AppContext))
-> ReaderT
(Logger Hasura, Manager)
(ExceptT QErr IO)
(Result
(ReaderT (Logger Hasura, Manager) (ExceptT QErr IO))
(ServeOptions impl, Environment, InvalidationKeys)
AppContext)
-> ExceptT
QErr
IO
(Result
(ReaderT (Logger Hasura, Manager) (ExceptT QErr IO))
(ServeOptions impl, Environment, InvalidationKeys)
AppContext)
forall a b. (a -> b) -> a -> b
$ Rule
(ReaderT (Logger Hasura, Manager) (ExceptT QErr IO))
(ServeOptions impl, Environment, InvalidationKeys)
AppContext
-> (ServeOptions impl, Environment, InvalidationKeys)
-> ReaderT
(Logger Hasura, Manager)
(ExceptT QErr IO)
(Result
(ReaderT (Logger Hasura, Manager) (ExceptT QErr IO))
(ServeOptions impl, Environment, InvalidationKeys)
AppContext)
forall (m :: * -> *) a b.
Applicative m =>
Rule m a b -> a -> m (Result m a b)
Inc.build (Rule
(ReaderT (Logger Hasura, Manager) (ExceptT QErr IO))
(ServeOptions impl, Environment, InvalidationKeys)
AppContext
forall (arr :: * -> * -> *) (m :: * -> *) impl.
(ArrowChoice arr, ArrowCache m arr, MonadBaseControl IO m,
MonadIO m, MonadError QErr m,
MonadReader (Logger Hasura, Manager) m) =>
arr (ServeOptions impl, Environment, InvalidationKeys) AppContext
buildAppContextRule) (ServeOptions impl
serveOptions, Environment
env, InvalidationKeys
initInvalidationKeys)
let !appContext :: AppContext
appContext = Result
(ReaderT (Logger Hasura, Manager) (ExceptT QErr IO))
(ServeOptions impl, Environment, InvalidationKeys)
AppContext
-> AppContext
forall {k} (m :: k -> *) a b. Result m a b -> b
Inc.result Result
(ReaderT (Logger Hasura, Manager) (ExceptT QErr IO))
(ServeOptions impl, Environment, InvalidationKeys)
AppContext
result
let !rebuildableAppContext :: RebuildableAppContext impl
rebuildableAppContext = AppContext
-> InvalidationKeys
-> Rule
(ReaderT (Logger Hasura, Manager) (ExceptT QErr IO))
(ServeOptions impl, Environment, InvalidationKeys)
AppContext
-> RebuildableAppContext impl
forall impl.
AppContext
-> InvalidationKeys
-> Rule
(ReaderT (Logger Hasura, Manager) (ExceptT QErr IO))
(ServeOptions impl, Environment, InvalidationKeys)
AppContext
-> RebuildableAppContext impl
RebuildableAppContext AppContext
appContext InvalidationKeys
initInvalidationKeys (Result
(ReaderT (Logger Hasura, Manager) (ExceptT QErr IO))
(ServeOptions impl, Environment, InvalidationKeys)
AppContext
-> Rule
(ReaderT (Logger Hasura, Manager) (ExceptT QErr IO))
(ServeOptions impl, Environment, InvalidationKeys)
AppContext
forall {k} (m :: k -> *) a b. Result m a b -> Rule m a b
Inc.rebuildRule Result
(ReaderT (Logger Hasura, Manager) (ExceptT QErr IO))
(ServeOptions impl, Environment, InvalidationKeys)
AppContext
result)
RebuildableAppContext impl
-> ExceptT QErr IO (RebuildableAppContext impl)
forall a. a -> ExceptT QErr IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure RebuildableAppContext impl
rebuildableAppContext
rebuildRebuildableAppContext ::
(MonadIO m, MonadError QErr m) =>
(L.Logger L.Hasura, HTTP.Manager) ->
RebuildableAppContext impl ->
ServeOptions impl ->
E.Environment ->
m (RebuildableAppContext impl)
rebuildRebuildableAppContext :: forall (m :: * -> *) impl.
(MonadIO m, MonadError QErr m) =>
(Logger Hasura, Manager)
-> RebuildableAppContext impl
-> ServeOptions impl
-> Environment
-> m (RebuildableAppContext impl)
rebuildRebuildableAppContext (Logger Hasura, Manager)
readerCtx (RebuildableAppContext AppContext
_ InvalidationKeys
_ Rule
(ReaderT (Logger Hasura, Manager) (ExceptT QErr IO))
(ServeOptions impl, Environment, InvalidationKeys)
AppContext
rule) ServeOptions impl
serveOptions Environment
env = do
let newInvalidationKeys :: InvalidationKeys
newInvalidationKeys = InvalidationKeys
InvalidationKeys
Result
(ReaderT (Logger Hasura, Manager) (ExceptT QErr IO))
(ServeOptions impl, Environment, InvalidationKeys)
AppContext
result <-
m (Either
QErr
(Result
(ReaderT (Logger Hasura, Manager) (ExceptT QErr IO))
(ServeOptions impl, Environment, InvalidationKeys)
AppContext))
-> m (Result
(ReaderT (Logger Hasura, Manager) (ExceptT QErr IO))
(ServeOptions impl, Environment, InvalidationKeys)
AppContext)
forall e (m :: * -> *) a. MonadError e m => m (Either e a) -> m a
liftEitherM
(m (Either
QErr
(Result
(ReaderT (Logger Hasura, Manager) (ExceptT QErr IO))
(ServeOptions impl, Environment, InvalidationKeys)
AppContext))
-> m (Result
(ReaderT (Logger Hasura, Manager) (ExceptT QErr IO))
(ServeOptions impl, Environment, InvalidationKeys)
AppContext))
-> m (Either
QErr
(Result
(ReaderT (Logger Hasura, Manager) (ExceptT QErr IO))
(ServeOptions impl, Environment, InvalidationKeys)
AppContext))
-> m (Result
(ReaderT (Logger Hasura, Manager) (ExceptT QErr IO))
(ServeOptions impl, Environment, InvalidationKeys)
AppContext)
forall a b. (a -> b) -> a -> b
$ IO
(Either
QErr
(Result
(ReaderT (Logger Hasura, Manager) (ExceptT QErr IO))
(ServeOptions impl, Environment, InvalidationKeys)
AppContext))
-> m (Either
QErr
(Result
(ReaderT (Logger Hasura, Manager) (ExceptT QErr IO))
(ServeOptions impl, Environment, InvalidationKeys)
AppContext))
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO
(IO
(Either
QErr
(Result
(ReaderT (Logger Hasura, Manager) (ExceptT QErr IO))
(ServeOptions impl, Environment, InvalidationKeys)
AppContext))
-> m (Either
QErr
(Result
(ReaderT (Logger Hasura, Manager) (ExceptT QErr IO))
(ServeOptions impl, Environment, InvalidationKeys)
AppContext)))
-> IO
(Either
QErr
(Result
(ReaderT (Logger Hasura, Manager) (ExceptT QErr IO))
(ServeOptions impl, Environment, InvalidationKeys)
AppContext))
-> m (Either
QErr
(Result
(ReaderT (Logger Hasura, Manager) (ExceptT QErr IO))
(ServeOptions impl, Environment, InvalidationKeys)
AppContext))
forall a b. (a -> b) -> a -> b
$ ExceptT
QErr
IO
(Result
(ReaderT (Logger Hasura, Manager) (ExceptT QErr IO))
(ServeOptions impl, Environment, InvalidationKeys)
AppContext)
-> IO
(Either
QErr
(Result
(ReaderT (Logger Hasura, Manager) (ExceptT QErr IO))
(ServeOptions impl, Environment, InvalidationKeys)
AppContext))
forall e (m :: * -> *) a. ExceptT e m a -> m (Either e a)
runExceptT
(ExceptT
QErr
IO
(Result
(ReaderT (Logger Hasura, Manager) (ExceptT QErr IO))
(ServeOptions impl, Environment, InvalidationKeys)
AppContext)
-> IO
(Either
QErr
(Result
(ReaderT (Logger Hasura, Manager) (ExceptT QErr IO))
(ServeOptions impl, Environment, InvalidationKeys)
AppContext)))
-> ExceptT
QErr
IO
(Result
(ReaderT (Logger Hasura, Manager) (ExceptT QErr IO))
(ServeOptions impl, Environment, InvalidationKeys)
AppContext)
-> IO
(Either
QErr
(Result
(ReaderT (Logger Hasura, Manager) (ExceptT QErr IO))
(ServeOptions impl, Environment, InvalidationKeys)
AppContext))
forall a b. (a -> b) -> a -> b
$ (ReaderT
(Logger Hasura, Manager)
(ExceptT QErr IO)
(Result
(ReaderT (Logger Hasura, Manager) (ExceptT QErr IO))
(ServeOptions impl, Environment, InvalidationKeys)
AppContext)
-> (Logger Hasura, Manager)
-> ExceptT
QErr
IO
(Result
(ReaderT (Logger Hasura, Manager) (ExceptT QErr IO))
(ServeOptions impl, Environment, InvalidationKeys)
AppContext))
-> (Logger Hasura, Manager)
-> ReaderT
(Logger Hasura, Manager)
(ExceptT QErr IO)
(Result
(ReaderT (Logger Hasura, Manager) (ExceptT QErr IO))
(ServeOptions impl, Environment, InvalidationKeys)
AppContext)
-> ExceptT
QErr
IO
(Result
(ReaderT (Logger Hasura, Manager) (ExceptT QErr IO))
(ServeOptions impl, Environment, InvalidationKeys)
AppContext)
forall a b c. (a -> b -> c) -> b -> a -> c
flip ReaderT
(Logger Hasura, Manager)
(ExceptT QErr IO)
(Result
(ReaderT (Logger Hasura, Manager) (ExceptT QErr IO))
(ServeOptions impl, Environment, InvalidationKeys)
AppContext)
-> (Logger Hasura, Manager)
-> ExceptT
QErr
IO
(Result
(ReaderT (Logger Hasura, Manager) (ExceptT QErr IO))
(ServeOptions impl, Environment, InvalidationKeys)
AppContext)
forall r (m :: * -> *) a. ReaderT r m a -> r -> m a
runReaderT (Logger Hasura, Manager)
readerCtx
(ReaderT
(Logger Hasura, Manager)
(ExceptT QErr IO)
(Result
(ReaderT (Logger Hasura, Manager) (ExceptT QErr IO))
(ServeOptions impl, Environment, InvalidationKeys)
AppContext)
-> ExceptT
QErr
IO
(Result
(ReaderT (Logger Hasura, Manager) (ExceptT QErr IO))
(ServeOptions impl, Environment, InvalidationKeys)
AppContext))
-> ReaderT
(Logger Hasura, Manager)
(ExceptT QErr IO)
(Result
(ReaderT (Logger Hasura, Manager) (ExceptT QErr IO))
(ServeOptions impl, Environment, InvalidationKeys)
AppContext)
-> ExceptT
QErr
IO
(Result
(ReaderT (Logger Hasura, Manager) (ExceptT QErr IO))
(ServeOptions impl, Environment, InvalidationKeys)
AppContext)
forall a b. (a -> b) -> a -> b
$ Rule
(ReaderT (Logger Hasura, Manager) (ExceptT QErr IO))
(ServeOptions impl, Environment, InvalidationKeys)
AppContext
-> (ServeOptions impl, Environment, InvalidationKeys)
-> ReaderT
(Logger Hasura, Manager)
(ExceptT QErr IO)
(Result
(ReaderT (Logger Hasura, Manager) (ExceptT QErr IO))
(ServeOptions impl, Environment, InvalidationKeys)
AppContext)
forall (m :: * -> *) a b.
Applicative m =>
Rule m a b -> a -> m (Result m a b)
Inc.build Rule
(ReaderT (Logger Hasura, Manager) (ExceptT QErr IO))
(ServeOptions impl, Environment, InvalidationKeys)
AppContext
rule (ServeOptions impl
serveOptions, Environment
env, InvalidationKeys
newInvalidationKeys)
let appContext :: AppContext
appContext = Result
(ReaderT (Logger Hasura, Manager) (ExceptT QErr IO))
(ServeOptions impl, Environment, InvalidationKeys)
AppContext
-> AppContext
forall {k} (m :: k -> *) a b. Result m a b -> b
Inc.result Result
(ReaderT (Logger Hasura, Manager) (ExceptT QErr IO))
(ServeOptions impl, Environment, InvalidationKeys)
AppContext
result
!newCtx :: RebuildableAppContext impl
newCtx = AppContext
-> InvalidationKeys
-> Rule
(ReaderT (Logger Hasura, Manager) (ExceptT QErr IO))
(ServeOptions impl, Environment, InvalidationKeys)
AppContext
-> RebuildableAppContext impl
forall impl.
AppContext
-> InvalidationKeys
-> Rule
(ReaderT (Logger Hasura, Manager) (ExceptT QErr IO))
(ServeOptions impl, Environment, InvalidationKeys)
AppContext
-> RebuildableAppContext impl
RebuildableAppContext AppContext
appContext InvalidationKeys
newInvalidationKeys (Result
(ReaderT (Logger Hasura, Manager) (ExceptT QErr IO))
(ServeOptions impl, Environment, InvalidationKeys)
AppContext
-> Rule
(ReaderT (Logger Hasura, Manager) (ExceptT QErr IO))
(ServeOptions impl, Environment, InvalidationKeys)
AppContext
forall {k} (m :: k -> *) a b. Result m a b -> Rule m a b
Inc.rebuildRule Result
(ReaderT (Logger Hasura, Manager) (ExceptT QErr IO))
(ServeOptions impl, Environment, InvalidationKeys)
AppContext
result)
RebuildableAppContext impl -> m (RebuildableAppContext impl)
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure RebuildableAppContext impl
newCtx
buildAppContextRule ::
forall arr m impl.
( ArrowChoice arr,
Inc.ArrowCache m arr,
MonadBaseControl IO m,
MonadIO m,
MonadError QErr m,
MonadReader (L.Logger L.Hasura, HTTP.Manager) m
) =>
(ServeOptions impl, E.Environment, InvalidationKeys) `arr` AppContext
buildAppContextRule :: forall (arr :: * -> * -> *) (m :: * -> *) impl.
(ArrowChoice arr, ArrowCache m arr, MonadBaseControl IO m,
MonadIO m, MonadError QErr m,
MonadReader (Logger Hasura, Manager) m) =>
arr (ServeOptions impl, Environment, InvalidationKeys) AppContext
buildAppContextRule = proc (ServeOptions {Int
[JWTConfig]
Maybe Text
Maybe RoleName
Maybe AuthHook
HostPreference
HashSet (EngineLogType impl)
HashSet ExperimentalFeature
HashSet AdminSecretHash
HashSet API
TxIsolation
ConnParams
Refined NonNegative Int
Refined NonNegative Milliseconds
Refined NonNegative Seconds
Refined Positive Int
ConnectionOptions
LiveQueriesOptions
LogLevel
NamingCase
RemoteSchemaPermissions
InferFunctionPermissions
DangerouslyCollapseBooleans
StringifyNumbers
ExtensionsSchema
CloseWebsocketsOnMetadataChangeStatus
ApolloFederationStatus
EventingMode
ReadOnlyMode
MaintenanceMode ()
CorsConfig
MetadataQueryLoggingMode
MetadataDefaults
WSConnectionInitTimeout
KeepAliveDelay
OptionalInterval
Port
TelemetryStatus
DevModeStatus
AllowListStatus
AdminInternalErrorsStatus
ConsoleStatus
soPort :: Port
soHost :: HostPreference
soConnParams :: ConnParams
soTxIso :: TxIsolation
soAdminSecret :: HashSet AdminSecretHash
soAuthHook :: Maybe AuthHook
soJwtSecret :: [JWTConfig]
soUnAuthRole :: Maybe RoleName
soCorsConfig :: CorsConfig
soConsoleStatus :: ConsoleStatus
soConsoleAssetsDir :: Maybe Text
soConsoleSentryDsn :: Maybe Text
soEnableTelemetry :: TelemetryStatus
soStringifyNum :: StringifyNumbers
soDangerousBooleanCollapse :: DangerouslyCollapseBooleans
soEnabledAPIs :: HashSet API
soLiveQueryOpts :: LiveQueriesOptions
soStreamingQueryOpts :: LiveQueriesOptions
soEnableAllowList :: AllowListStatus
soEnabledLogTypes :: HashSet (EngineLogType impl)
soLogLevel :: LogLevel
soEventsHttpPoolSize :: Refined Positive Int
soEventsFetchInterval :: Refined NonNegative Milliseconds
soAsyncActionsFetchInterval :: OptionalInterval
soEnableRemoteSchemaPermissions :: RemoteSchemaPermissions
soConnectionOptions :: ConnectionOptions
soWebSocketKeepAlive :: KeepAliveDelay
soInferFunctionPermissions :: InferFunctionPermissions
soEnableMaintenanceMode :: MaintenanceMode ()
soSchemaPollInterval :: OptionalInterval
soExperimentalFeatures :: HashSet ExperimentalFeature
soEventsFetchBatchSize :: Refined NonNegative Int
soDevMode :: DevModeStatus
soAdminInternalErrors :: AdminInternalErrorsStatus
soGracefulShutdownTimeout :: Refined NonNegative Seconds
soWebSocketConnectionInitTimeout :: WSConnectionInitTimeout
soEventingMode :: EventingMode
soReadOnlyMode :: ReadOnlyMode
soEnableMetadataQueryLogging :: MetadataQueryLoggingMode
soDefaultNamingConvention :: NamingCase
soExtensionsSchema :: ExtensionsSchema
soMetadataDefaults :: MetadataDefaults
soApolloFederationStatus :: ApolloFederationStatus
soCloseWebsocketsOnMetadataChangeStatus :: CloseWebsocketsOnMetadataChangeStatus
soMaxTotalHeaderLength :: Int
soPort :: forall impl. ServeOptions impl -> Port
soHost :: forall impl. ServeOptions impl -> HostPreference
soConnParams :: forall impl. ServeOptions impl -> ConnParams
soTxIso :: forall impl. ServeOptions impl -> TxIsolation
soAdminSecret :: forall impl. ServeOptions impl -> HashSet AdminSecretHash
soAuthHook :: forall impl. ServeOptions impl -> Maybe AuthHook
soJwtSecret :: forall impl. ServeOptions impl -> [JWTConfig]
soUnAuthRole :: forall impl. ServeOptions impl -> Maybe RoleName
soCorsConfig :: forall impl. ServeOptions impl -> CorsConfig
soConsoleStatus :: forall impl. ServeOptions impl -> ConsoleStatus
soConsoleAssetsDir :: forall impl. ServeOptions impl -> Maybe Text
soConsoleSentryDsn :: forall impl. ServeOptions impl -> Maybe Text
soEnableTelemetry :: forall impl. ServeOptions impl -> TelemetryStatus
soStringifyNum :: forall impl. ServeOptions impl -> StringifyNumbers
soDangerousBooleanCollapse :: forall impl. ServeOptions impl -> DangerouslyCollapseBooleans
soEnabledAPIs :: forall impl. ServeOptions impl -> HashSet API
soLiveQueryOpts :: forall impl. ServeOptions impl -> LiveQueriesOptions
soStreamingQueryOpts :: forall impl. ServeOptions impl -> LiveQueriesOptions
soEnableAllowList :: forall impl. ServeOptions impl -> AllowListStatus
soEnabledLogTypes :: forall impl. ServeOptions impl -> HashSet (EngineLogType impl)
soLogLevel :: forall impl. ServeOptions impl -> LogLevel
soEventsHttpPoolSize :: forall impl. ServeOptions impl -> Refined Positive Int
soEventsFetchInterval :: forall impl. ServeOptions impl -> Refined NonNegative Milliseconds
soAsyncActionsFetchInterval :: forall impl. ServeOptions impl -> OptionalInterval
soEnableRemoteSchemaPermissions :: forall impl. ServeOptions impl -> RemoteSchemaPermissions
soConnectionOptions :: forall impl. ServeOptions impl -> ConnectionOptions
soWebSocketKeepAlive :: forall impl. ServeOptions impl -> KeepAliveDelay
soInferFunctionPermissions :: forall impl. ServeOptions impl -> InferFunctionPermissions
soEnableMaintenanceMode :: forall impl. ServeOptions impl -> MaintenanceMode ()
soSchemaPollInterval :: forall impl. ServeOptions impl -> OptionalInterval
soExperimentalFeatures :: forall impl. ServeOptions impl -> HashSet ExperimentalFeature
soEventsFetchBatchSize :: forall impl. ServeOptions impl -> Refined NonNegative Int
soDevMode :: forall impl. ServeOptions impl -> DevModeStatus
soAdminInternalErrors :: forall impl. ServeOptions impl -> AdminInternalErrorsStatus
soGracefulShutdownTimeout :: forall impl. ServeOptions impl -> Refined NonNegative Seconds
soWebSocketConnectionInitTimeout :: forall impl. ServeOptions impl -> WSConnectionInitTimeout
soEventingMode :: forall impl. ServeOptions impl -> EventingMode
soReadOnlyMode :: forall impl. ServeOptions impl -> ReadOnlyMode
soEnableMetadataQueryLogging :: forall impl. ServeOptions impl -> MetadataQueryLoggingMode
soDefaultNamingConvention :: forall impl. ServeOptions impl -> NamingCase
soExtensionsSchema :: forall impl. ServeOptions impl -> ExtensionsSchema
soMetadataDefaults :: forall impl. ServeOptions impl -> MetadataDefaults
soApolloFederationStatus :: forall impl. ServeOptions impl -> ApolloFederationStatus
soCloseWebsocketsOnMetadataChangeStatus :: forall impl.
ServeOptions impl -> CloseWebsocketsOnMetadataChangeStatus
soMaxTotalHeaderLength :: forall impl. ServeOptions impl -> Int
..}, Environment
env, InvalidationKeys
_keys) -> do
AuthMode
authMode <- arr
(HashSet AdminSecretHash, Maybe AuthHook, [JWTConfig],
Maybe RoleName)
AuthMode
buildAuthMode -< (HashSet AdminSecretHash
soAdminSecret, Maybe AuthHook
soAuthHook, [JWTConfig]
soJwtSecret, Maybe RoleName
soUnAuthRole)
SQLGenCtx
sqlGenCtx <- arr
(HashSet ExperimentalFeature, StringifyNumbers,
DangerouslyCollapseBooleans)
SQLGenCtx
buildSqlGenCtx -< (HashSet ExperimentalFeature
soExperimentalFeatures, StringifyNumbers
soStringifyNum, DangerouslyCollapseBooleans
soDangerousBooleanCollapse)
ResponseInternalErrorsConfig
responseInternalErrorsConfig <- arr
(AdminInternalErrorsStatus, DevModeStatus)
ResponseInternalErrorsConfig
buildResponseInternalErrorsConfig -< (AdminInternalErrorsStatus
soAdminInternalErrors, DevModeStatus
soDevMode)
EventEngineCtx
eventEngineCtx <- arr
(Refined Positive Int, Refined NonNegative Milliseconds,
Refined NonNegative Int)
EventEngineCtx
buildEventEngineCtx -< (Refined Positive Int
soEventsHttpPoolSize, Refined NonNegative Milliseconds
soEventsFetchInterval, Refined NonNegative Int
soEventsFetchBatchSize)
arr AppContext AppContext
forall (a :: * -> * -> *) b. Arrow a => a b b
returnA
-<
AppContext
{ acAuthMode :: AuthMode
acAuthMode = AuthMode
authMode,
acSQLGenCtx :: SQLGenCtx
acSQLGenCtx = SQLGenCtx
sqlGenCtx,
acEnabledAPIs :: HashSet API
acEnabledAPIs = HashSet API
soEnabledAPIs,
acEnableAllowlist :: AllowListStatus
acEnableAllowlist = AllowListStatus
soEnableAllowList,
acResponseInternalErrorsConfig :: ResponseInternalErrorsConfig
acResponseInternalErrorsConfig = ResponseInternalErrorsConfig
responseInternalErrorsConfig,
acEnvironment :: Environment
acEnvironment = Environment
env,
acRemoteSchemaPermsCtx :: RemoteSchemaPermissions
acRemoteSchemaPermsCtx = RemoteSchemaPermissions
soEnableRemoteSchemaPermissions,
acFunctionPermsCtx :: InferFunctionPermissions
acFunctionPermsCtx = InferFunctionPermissions
soInferFunctionPermissions,
acExperimentalFeatures :: HashSet ExperimentalFeature
acExperimentalFeatures = HashSet ExperimentalFeature
soExperimentalFeatures,
acDefaultNamingConvention :: NamingCase
acDefaultNamingConvention = NamingCase
soDefaultNamingConvention,
acMetadataDefaults :: MetadataDefaults
acMetadataDefaults = MetadataDefaults
soMetadataDefaults,
acLiveQueryOptions :: LiveQueriesOptions
acLiveQueryOptions = LiveQueriesOptions
soLiveQueryOpts,
acStreamQueryOptions :: LiveQueriesOptions
acStreamQueryOptions = LiveQueriesOptions
soStreamingQueryOpts,
acCorsPolicy :: CorsPolicy
acCorsPolicy = CorsConfig -> CorsPolicy
Cors.mkDefaultCorsPolicy CorsConfig
soCorsConfig,
acConsoleStatus :: ConsoleStatus
acConsoleStatus = ConsoleStatus
soConsoleStatus,
acEnableTelemetry :: TelemetryStatus
acEnableTelemetry = TelemetryStatus
soEnableTelemetry,
acEventEngineCtx :: EventEngineCtx
acEventEngineCtx = EventEngineCtx
eventEngineCtx,
acAsyncActionsFetchInterval :: OptionalInterval
acAsyncActionsFetchInterval = OptionalInterval
soAsyncActionsFetchInterval,
acApolloFederationStatus :: ApolloFederationStatus
acApolloFederationStatus = ApolloFederationStatus
soApolloFederationStatus,
acCloseWebsocketsOnMetadataChangeStatus :: CloseWebsocketsOnMetadataChangeStatus
acCloseWebsocketsOnMetadataChangeStatus = CloseWebsocketsOnMetadataChangeStatus
soCloseWebsocketsOnMetadataChangeStatus
}
where
buildSqlGenCtx :: arr
(HashSet ExperimentalFeature, StringifyNumbers,
DangerouslyCollapseBooleans)
SQLGenCtx
buildSqlGenCtx = arr
(HashSet ExperimentalFeature, StringifyNumbers,
DangerouslyCollapseBooleans)
SQLGenCtx
-> arr
(HashSet ExperimentalFeature, StringifyNumbers,
DangerouslyCollapseBooleans)
SQLGenCtx
forall a b. (Given Accesses => Eq a) => arr a b -> arr a b
forall (m :: * -> *) (arr :: * -> * -> *) a b.
(ArrowCache m arr, Given Accesses => Eq a) =>
arr a b -> arr a b
Inc.cache proc (HashSet ExperimentalFeature
experimentalFeatures, StringifyNumbers
stringifyNum, DangerouslyCollapseBooleans
dangerousBooleanCollapse) -> do
let sqlGenCtx :: SQLGenCtx
sqlGenCtx = HashSet ExperimentalFeature
-> StringifyNumbers -> DangerouslyCollapseBooleans -> SQLGenCtx
initSQLGenCtx HashSet ExperimentalFeature
experimentalFeatures StringifyNumbers
stringifyNum DangerouslyCollapseBooleans
dangerousBooleanCollapse
arr SQLGenCtx SQLGenCtx
forall (a :: * -> * -> *) b. Arrow a => a b b
returnA -< SQLGenCtx
sqlGenCtx
buildEventEngineCtx :: arr
(Refined Positive Int, Refined NonNegative Milliseconds,
Refined NonNegative Int)
EventEngineCtx
buildEventEngineCtx = arr
(Refined Positive Int, Refined NonNegative Milliseconds,
Refined NonNegative Int)
EventEngineCtx
-> arr
(Refined Positive Int, Refined NonNegative Milliseconds,
Refined NonNegative Int)
EventEngineCtx
forall a b. (Given Accesses => Eq a) => arr a b -> arr a b
forall (m :: * -> *) (arr :: * -> * -> *) a b.
(ArrowCache m arr, Given Accesses => Eq a) =>
arr a b -> arr a b
Inc.cache proc (Refined Positive Int
httpPoolSize, Refined NonNegative Milliseconds
fetchInterval, Refined NonNegative Int
fetchBatchSize) -> do
EventEngineCtx
eventEngineCtx <- arr (m EventEngineCtx) EventEngineCtx
forall (m :: * -> *) (arr :: * -> * -> *) a.
ArrowKleisli m arr =>
arr (m a) a
bindA -< Refined Positive Int
-> Refined NonNegative Milliseconds
-> Refined NonNegative Int
-> m EventEngineCtx
forall (m :: * -> *).
MonadIO m =>
Refined Positive Int
-> Refined NonNegative Milliseconds
-> Refined NonNegative Int
-> m EventEngineCtx
initEventEngineCtx Refined Positive Int
httpPoolSize Refined NonNegative Milliseconds
fetchInterval Refined NonNegative Int
fetchBatchSize
arr EventEngineCtx EventEngineCtx
forall (a :: * -> * -> *) b. Arrow a => a b b
returnA -< EventEngineCtx
eventEngineCtx
buildAuthMode :: (Set.HashSet AdminSecretHash, Maybe AuthHook, [JWTConfig], Maybe RoleName) `arr` AuthMode
buildAuthMode :: arr
(HashSet AdminSecretHash, Maybe AuthHook, [JWTConfig],
Maybe RoleName)
AuthMode
buildAuthMode = arr
(HashSet AdminSecretHash, Maybe AuthHook, [JWTConfig],
Maybe RoleName)
AuthMode
-> arr
(HashSet AdminSecretHash, Maybe AuthHook, [JWTConfig],
Maybe RoleName)
AuthMode
forall a b. (Given Accesses => Eq a) => arr a b -> arr a b
forall (m :: * -> *) (arr :: * -> * -> *) a b.
(ArrowCache m arr, Given Accesses => Eq a) =>
arr a b -> arr a b
Inc.cache proc (HashSet AdminSecretHash
adminSecretHashSet, Maybe AuthHook
webHook, [JWTConfig]
jwtSecrets, Maybe RoleName
unAuthRole) -> do
AuthMode
authMode <-
arr (m AuthMode) AuthMode
forall (m :: * -> *) (arr :: * -> * -> *) a.
ArrowKleisli m arr =>
arr (m a) a
bindA
-< do
(Logger Hasura
logger, Manager
httpManager) <- m (Logger Hasura, Manager)
forall r (m :: * -> *). MonadReader r m => m r
ask
Either Text AuthMode
authModeRes <-
ExceptT Text m AuthMode -> m (Either Text AuthMode)
forall e (m :: * -> *) a. ExceptT e m a -> m (Either e a)
runExceptT
(ExceptT Text m AuthMode -> m (Either Text AuthMode))
-> ExceptT Text m AuthMode -> m (Either Text AuthMode)
forall a b. (a -> b) -> a -> b
$ HashSet AdminSecretHash
-> Maybe AuthHook
-> [JWTConfig]
-> Maybe RoleName
-> Logger Hasura
-> Manager
-> ExceptT Text m AuthMode
forall (m :: * -> *).
(MonadError Text m, MonadIO m, MonadBaseControl IO m) =>
HashSet AdminSecretHash
-> Maybe AuthHook
-> [JWTConfig]
-> Maybe RoleName
-> Logger Hasura
-> Manager
-> m AuthMode
setupAuthMode
HashSet AdminSecretHash
adminSecretHashSet
Maybe AuthHook
webHook
[JWTConfig]
jwtSecrets
Maybe RoleName
unAuthRole
Logger Hasura
logger
Manager
httpManager
Either Text AuthMode -> (Text -> m AuthMode) -> m AuthMode
forall (m :: * -> *) e a.
Applicative m =>
Either e a -> (e -> m a) -> m a
onLeft Either Text AuthMode
authModeRes Text -> m AuthMode
forall (m :: * -> *) a. QErrM m => Text -> m a
throw500
arr AuthMode AuthMode
forall (a :: * -> * -> *) b. Arrow a => a b b
returnA -< AuthMode
authMode
buildResponseInternalErrorsConfig :: (AdminInternalErrorsStatus, DevModeStatus) `arr` ResponseInternalErrorsConfig
buildResponseInternalErrorsConfig :: arr
(AdminInternalErrorsStatus, DevModeStatus)
ResponseInternalErrorsConfig
buildResponseInternalErrorsConfig = arr
(AdminInternalErrorsStatus, DevModeStatus)
ResponseInternalErrorsConfig
-> arr
(AdminInternalErrorsStatus, DevModeStatus)
ResponseInternalErrorsConfig
forall a b. (Given Accesses => Eq a) => arr a b -> arr a b
forall (m :: * -> *) (arr :: * -> * -> *) a b.
(ArrowCache m arr, Given Accesses => Eq a) =>
arr a b -> arr a b
Inc.cache proc (AdminInternalErrorsStatus
adminInternalErrors, DevModeStatus
devMode) -> do
let responseInternalErrorsConfig :: ResponseInternalErrorsConfig
responseInternalErrorsConfig =
if
| DevModeStatus -> Bool
isDevModeEnabled DevModeStatus
devMode -> ResponseInternalErrorsConfig
InternalErrorsAllRequests
| AdminInternalErrorsStatus -> Bool
isAdminInternalErrorsEnabled AdminInternalErrorsStatus
adminInternalErrors -> ResponseInternalErrorsConfig
InternalErrorsAdminOnly
| Bool
otherwise -> ResponseInternalErrorsConfig
InternalErrorsDisabled
arr ResponseInternalErrorsConfig ResponseInternalErrorsConfig
forall (a :: * -> * -> *) b. Arrow a => a b b
returnA -< ResponseInternalErrorsConfig
responseInternalErrorsConfig
initSQLGenCtx :: HashSet ExperimentalFeature -> Options.StringifyNumbers -> Options.DangerouslyCollapseBooleans -> SQLGenCtx
initSQLGenCtx :: HashSet ExperimentalFeature
-> StringifyNumbers -> DangerouslyCollapseBooleans -> SQLGenCtx
initSQLGenCtx HashSet ExperimentalFeature
experimentalFeatures StringifyNumbers
stringifyNum DangerouslyCollapseBooleans
dangerousBooleanCollapse =
let optimizePermissionFilters :: OptimizePermissionFilters
optimizePermissionFilters
| ExperimentalFeature
EFOptimizePermissionFilters ExperimentalFeature -> HashSet ExperimentalFeature -> Bool
forall a. Eq a => a -> HashSet a -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` HashSet ExperimentalFeature
experimentalFeatures = OptimizePermissionFilters
Options.OptimizePermissionFilters
| Bool
otherwise = OptimizePermissionFilters
Options.Don'tOptimizePermissionFilters
bigqueryStringNumericInput :: BigQueryStringNumericInput
bigqueryStringNumericInput
| ExperimentalFeature
EFBigQueryStringNumericInput ExperimentalFeature -> HashSet ExperimentalFeature -> Bool
forall a. Eq a => a -> HashSet a -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` HashSet ExperimentalFeature
experimentalFeatures = BigQueryStringNumericInput
Options.EnableBigQueryStringNumericInput
| Bool
otherwise = BigQueryStringNumericInput
Options.DisableBigQueryStringNumericInput
in StringifyNumbers
-> DangerouslyCollapseBooleans
-> OptimizePermissionFilters
-> BigQueryStringNumericInput
-> SQLGenCtx
SQLGenCtx StringifyNumbers
stringifyNum DangerouslyCollapseBooleans
dangerousBooleanCollapse OptimizePermissionFilters
optimizePermissionFilters BigQueryStringNumericInput
bigqueryStringNumericInput
buildCacheStaticConfig :: AppEnv -> CacheStaticConfig
buildCacheStaticConfig :: AppEnv -> CacheStaticConfig
buildCacheStaticConfig AppEnv {Int
Maybe Text
Maybe PGPool
Maybe (CredentialCache AgentLicenseKey)
SamplingPolicy
HostPreference
Manager
TxIsolation
ConnParams
PGPool
Refined NonNegative Seconds
TMVar MetadataResourceVersion
ConnectionOptions
CheckFeatureFlag
ServerMetrics
EventingMode
ReadOnlyMode
MaintenanceMode ()
InstanceId
PrometheusMetrics
ShutdownLatch
LoggingSettings
LockedEventsCtx
WSConnectionInitTimeout
KeepAliveDelay
OptionalInterval
Port
SubscriptionsState
Loggers
appEnvPort :: AppEnv -> Port
appEnvHost :: AppEnv -> HostPreference
appEnvMetadataDbPool :: AppEnv -> PGPool
appEnvIntrospectionDbPool :: AppEnv -> Maybe PGPool
appEnvManager :: AppEnv -> Manager
appEnvLoggers :: AppEnv -> Loggers
appEnvMetadataVersionRef :: AppEnv -> TMVar MetadataResourceVersion
appEnvInstanceId :: AppEnv -> InstanceId
appEnvEnableMaintenanceMode :: AppEnv -> MaintenanceMode ()
appEnvLoggingSettings :: AppEnv -> LoggingSettings
appEnvEventingMode :: AppEnv -> EventingMode
appEnvEnableReadOnlyMode :: AppEnv -> ReadOnlyMode
appEnvServerMetrics :: AppEnv -> ServerMetrics
appEnvShutdownLatch :: AppEnv -> ShutdownLatch
appEnvMetaVersionRef :: AppEnv -> TMVar MetadataResourceVersion
appEnvPrometheusMetrics :: AppEnv -> PrometheusMetrics
appEnvTraceSamplingPolicy :: AppEnv -> SamplingPolicy
appEnvSubscriptionState :: AppEnv -> SubscriptionsState
appEnvLockedEventsCtx :: AppEnv -> LockedEventsCtx
appEnvConnParams :: AppEnv -> ConnParams
appEnvTxIso :: AppEnv -> TxIsolation
appEnvConsoleAssetsDir :: AppEnv -> Maybe Text
appEnvConsoleSentryDsn :: AppEnv -> Maybe Text
appEnvConnectionOptions :: AppEnv -> ConnectionOptions
appEnvWebSocketKeepAlive :: AppEnv -> KeepAliveDelay
appEnvWebSocketConnectionInitTimeout :: AppEnv -> WSConnectionInitTimeout
appEnvGracefulShutdownTimeout :: AppEnv -> Refined NonNegative Seconds
appEnvSchemaPollInterval :: AppEnv -> OptionalInterval
appEnvCheckFeatureFlag :: AppEnv -> CheckFeatureFlag
appEnvLicenseKeyCache :: AppEnv -> Maybe (CredentialCache AgentLicenseKey)
appEnvMaxTotalHeaderLength :: AppEnv -> Int
appEnvPort :: Port
appEnvHost :: HostPreference
appEnvMetadataDbPool :: PGPool
appEnvIntrospectionDbPool :: Maybe PGPool
appEnvManager :: Manager
appEnvLoggers :: Loggers
appEnvMetadataVersionRef :: TMVar MetadataResourceVersion
appEnvInstanceId :: InstanceId
appEnvEnableMaintenanceMode :: MaintenanceMode ()
appEnvLoggingSettings :: LoggingSettings
appEnvEventingMode :: EventingMode
appEnvEnableReadOnlyMode :: ReadOnlyMode
appEnvServerMetrics :: ServerMetrics
appEnvShutdownLatch :: ShutdownLatch
appEnvMetaVersionRef :: TMVar MetadataResourceVersion
appEnvPrometheusMetrics :: PrometheusMetrics
appEnvTraceSamplingPolicy :: SamplingPolicy
appEnvSubscriptionState :: SubscriptionsState
appEnvLockedEventsCtx :: LockedEventsCtx
appEnvConnParams :: ConnParams
appEnvTxIso :: TxIsolation
appEnvConsoleAssetsDir :: Maybe Text
appEnvConsoleSentryDsn :: Maybe Text
appEnvConnectionOptions :: ConnectionOptions
appEnvWebSocketKeepAlive :: KeepAliveDelay
appEnvWebSocketConnectionInitTimeout :: WSConnectionInitTimeout
appEnvGracefulShutdownTimeout :: Refined NonNegative Seconds
appEnvSchemaPollInterval :: OptionalInterval
appEnvCheckFeatureFlag :: CheckFeatureFlag
appEnvLicenseKeyCache :: Maybe (CredentialCache AgentLicenseKey)
appEnvMaxTotalHeaderLength :: Int
..} =
CacheStaticConfig
{ _cscMaintenanceMode :: MaintenanceMode ()
_cscMaintenanceMode = MaintenanceMode ()
appEnvEnableMaintenanceMode,
_cscEventingMode :: EventingMode
_cscEventingMode = EventingMode
appEnvEventingMode,
_cscReadOnlyMode :: ReadOnlyMode
_cscReadOnlyMode = ReadOnlyMode
appEnvEnableReadOnlyMode,
_cscLogger :: Logger Hasura
_cscLogger = Loggers -> Logger Hasura
_lsLogger Loggers
appEnvLoggers,
_cscAreNativeQueriesEnabled :: BackendType -> Bool
_cscAreNativeQueriesEnabled = \case
Postgres PostgresKind
Vanilla -> Bool
True
BackendType
_ -> Bool
False,
_cscAreStoredProceduresEnabled :: Bool
_cscAreStoredProceduresEnabled = Bool
False
}
buildCacheDynamicConfig :: AppContext -> CacheDynamicConfig
buildCacheDynamicConfig :: AppContext -> CacheDynamicConfig
buildCacheDynamicConfig AppContext {Environment
HashSet ExperimentalFeature
HashSet API
LiveQueriesOptions
NamingCase
RemoteSchemaPermissions
InferFunctionPermissions
SQLGenCtx
CloseWebsocketsOnMetadataChangeStatus
ApolloFederationStatus
CorsPolicy
AuthMode
MetadataDefaults
ResponseInternalErrorsConfig
OptionalInterval
TelemetryStatus
AllowListStatus
ConsoleStatus
EventEngineCtx
acAuthMode :: AppContext -> AuthMode
acSQLGenCtx :: AppContext -> SQLGenCtx
acEnabledAPIs :: AppContext -> HashSet API
acEnableAllowlist :: AppContext -> AllowListStatus
acResponseInternalErrorsConfig :: AppContext -> ResponseInternalErrorsConfig
acEnvironment :: AppContext -> Environment
acRemoteSchemaPermsCtx :: AppContext -> RemoteSchemaPermissions
acFunctionPermsCtx :: AppContext -> InferFunctionPermissions
acExperimentalFeatures :: AppContext -> HashSet ExperimentalFeature
acDefaultNamingConvention :: AppContext -> NamingCase
acMetadataDefaults :: AppContext -> MetadataDefaults
acLiveQueryOptions :: AppContext -> LiveQueriesOptions
acStreamQueryOptions :: AppContext -> LiveQueriesOptions
acCorsPolicy :: AppContext -> CorsPolicy
acConsoleStatus :: AppContext -> ConsoleStatus
acEnableTelemetry :: AppContext -> TelemetryStatus
acEventEngineCtx :: AppContext -> EventEngineCtx
acAsyncActionsFetchInterval :: AppContext -> OptionalInterval
acApolloFederationStatus :: AppContext -> ApolloFederationStatus
acCloseWebsocketsOnMetadataChangeStatus :: AppContext -> CloseWebsocketsOnMetadataChangeStatus
acAuthMode :: AuthMode
acSQLGenCtx :: SQLGenCtx
acEnabledAPIs :: HashSet API
acEnableAllowlist :: AllowListStatus
acResponseInternalErrorsConfig :: ResponseInternalErrorsConfig
acEnvironment :: Environment
acRemoteSchemaPermsCtx :: RemoteSchemaPermissions
acFunctionPermsCtx :: InferFunctionPermissions
acExperimentalFeatures :: HashSet ExperimentalFeature
acDefaultNamingConvention :: NamingCase
acMetadataDefaults :: MetadataDefaults
acLiveQueryOptions :: LiveQueriesOptions
acStreamQueryOptions :: LiveQueriesOptions
acCorsPolicy :: CorsPolicy
acConsoleStatus :: ConsoleStatus
acEnableTelemetry :: TelemetryStatus
acEventEngineCtx :: EventEngineCtx
acAsyncActionsFetchInterval :: OptionalInterval
acApolloFederationStatus :: ApolloFederationStatus
acCloseWebsocketsOnMetadataChangeStatus :: CloseWebsocketsOnMetadataChangeStatus
..} = do
CacheDynamicConfig
{ _cdcFunctionPermsCtx :: InferFunctionPermissions
_cdcFunctionPermsCtx = InferFunctionPermissions
acFunctionPermsCtx,
_cdcRemoteSchemaPermsCtx :: RemoteSchemaPermissions
_cdcRemoteSchemaPermsCtx = RemoteSchemaPermissions
acRemoteSchemaPermsCtx,
_cdcSQLGenCtx :: SQLGenCtx
_cdcSQLGenCtx = SQLGenCtx
acSQLGenCtx,
_cdcExperimentalFeatures :: HashSet ExperimentalFeature
_cdcExperimentalFeatures = HashSet ExperimentalFeature
acExperimentalFeatures,
_cdcDefaultNamingConvention :: NamingCase
_cdcDefaultNamingConvention = NamingCase
acDefaultNamingConvention,
_cdcMetadataDefaults :: MetadataDefaults
_cdcMetadataDefaults = MetadataDefaults
acMetadataDefaults,
_cdcApolloFederationStatus :: ApolloFederationStatus
_cdcApolloFederationStatus = ApolloFederationStatus
acApolloFederationStatus,
_cdcCloseWebsocketsOnMetadataChangeStatus :: CloseWebsocketsOnMetadataChangeStatus
_cdcCloseWebsocketsOnMetadataChangeStatus = CloseWebsocketsOnMetadataChangeStatus
acCloseWebsocketsOnMetadataChangeStatus
}