-- | The Arg Opt.Parser for the 'serve' subcommand.
module Hasura.Server.Init.Arg.Command.Serve
  ( -- * Opt.Parser
    serveCommandParser,

    -- * Options
    servePortOption,
    serveHostOption,
    pgStripesOption,
    pgConnsOption,
    pgTimeoutOption,
    pgConnLifetimeOption,
    pgUsePreparedStatementsOption,
    pgPoolTimeoutOption,
    txIsolationOption,
    adminSecretOption,
    accessKeyOption,
    authHookOption,
    authHookModeOption,
    jwtSecretOption,
    unAuthRoleOption,
    corsDomainOption,
    disableCorsOption,
    enableConsoleOption,
    consoleAssetsDirOption,
    enableTelemetryOption,
    wsReadCookieOption,
    stringifyNumOption,
    dangerousBooleanCollapseOption,
    enabledAPIsOption,
    mxRefetchDelayOption,
    mxBatchSizeOption,
    streamingMxRefetchDelayOption,
    streamingMxBatchSizeOption,
    enableAllowlistOption,
    enabledLogsOption,
    logLevelOption,
    graphqlDevModeOption,
    graphqlAdminInternalErrorsOption,
    graphqlEventsHttpPoolSizeOption,
    graphqlEventsFetchIntervalOption,
    asyncActionsFetchIntervalOption,
    enableRemoteSchemaPermsOption,
    webSocketCompressionOption,
    webSocketKeepAliveOption,
    inferFunctionPermsOption,
    enableMaintenanceModeOption,
    schemaPollIntervalOption,
    experimentalFeaturesOption,
    eventsFetchBatchSizeOption,
    gracefulShutdownOption,
    webSocketConnectionInitTimeoutOption,
    enableMetadataQueryLoggingOption,
    defaultNamingConventionOption,
    metadataDBExtensionsSchemaOption,

    -- * Pretty Printer
    serveCmdFooter,
  )
where

--------------------------------------------------------------------------------

import Data.HashSet qualified as HashSet
import Data.Text qualified as Text
import Data.Time qualified as Time
import Database.PG.Query qualified as Query
import Hasura.Backends.Postgres.Connection.MonadTx qualified as MonadTx
import Hasura.Cache.Bounded qualified as Bounded
import Hasura.GraphQL.Execute.Subscription.Options qualified as Subscription.Options
import Hasura.GraphQL.Schema.NamingCase (NamingCase)
import Hasura.GraphQL.Schema.Options qualified as Options
import Hasura.Logging qualified as Logging
import Hasura.Prelude
import Hasura.RQL.Types.Numeric qualified as Numeric
import Hasura.Server.Auth qualified as Auth
import Hasura.Server.Cors qualified as Cors
import Hasura.Server.Init.Arg.PrettyPrinter qualified as PP
import Hasura.Server.Init.Config qualified as Config
import Hasura.Server.Init.Env qualified as Env
import Hasura.Server.Logging qualified as Server.Logging
import Hasura.Server.Types qualified as Types
import Hasura.Session qualified as Session
import Network.Wai.Handler.Warp qualified as Warp
import Options.Applicative qualified as Opt
import Witch qualified

--------------------------------------------------------------------------------
-- Serve Command

serveCommandParser :: Logging.EnabledLogTypes impl => Opt.Parser (Config.ServeOptionsRaw impl)
serveCommandParser :: Parser (ServeOptionsRaw impl)
serveCommandParser =
  Maybe Port
-> Maybe HostPreference
-> ConnParamsRaw
-> Maybe TxIsolation
-> Maybe AdminSecretHash
-> AuthHookRaw
-> Maybe JWTConfig
-> Maybe RoleName
-> Maybe CorsConfig
-> Bool
-> Maybe Text
-> Maybe Bool
-> Bool
-> StringifyNumbers
-> Maybe DangerouslyCollapseBooleans
-> Maybe (HashSet API)
-> Maybe RefetchInterval
-> Maybe BatchSize
-> Maybe RefetchInterval
-> Maybe BatchSize
-> Bool
-> Maybe (HashSet (EngineLogType impl))
-> Maybe LogLevel
-> Bool
-> Maybe Bool
-> Maybe PositiveInt
-> Maybe (NonNegative Milliseconds)
-> Maybe OptionalInterval
-> RemoteSchemaPermissions
-> Bool
-> Maybe KeepAliveDelay
-> Maybe InferFunctionPermissions
-> MaintenanceMode ()
-> Maybe OptionalInterval
-> Maybe (HashSet ExperimentalFeature)
-> Maybe NonNegativeInt
-> Maybe (NonNegative Seconds)
-> Maybe WSConnectionInitTimeout
-> MetadataQueryLoggingMode
-> Maybe NamingCase
-> Maybe ExtensionsSchema
-> ServeOptionsRaw impl
forall impl.
Maybe Port
-> Maybe HostPreference
-> ConnParamsRaw
-> Maybe TxIsolation
-> Maybe AdminSecretHash
-> AuthHookRaw
-> Maybe JWTConfig
-> Maybe RoleName
-> Maybe CorsConfig
-> Bool
-> Maybe Text
-> Maybe Bool
-> Bool
-> StringifyNumbers
-> Maybe DangerouslyCollapseBooleans
-> Maybe (HashSet API)
-> Maybe RefetchInterval
-> Maybe BatchSize
-> Maybe RefetchInterval
-> Maybe BatchSize
-> Bool
-> Maybe (HashSet (EngineLogType impl))
-> Maybe LogLevel
-> Bool
-> Maybe Bool
-> Maybe PositiveInt
-> Maybe (NonNegative Milliseconds)
-> Maybe OptionalInterval
-> RemoteSchemaPermissions
-> Bool
-> Maybe KeepAliveDelay
-> Maybe InferFunctionPermissions
-> MaintenanceMode ()
-> Maybe OptionalInterval
-> Maybe (HashSet ExperimentalFeature)
-> Maybe NonNegativeInt
-> Maybe (NonNegative Seconds)
-> Maybe WSConnectionInitTimeout
-> MetadataQueryLoggingMode
-> Maybe NamingCase
-> Maybe ExtensionsSchema
-> ServeOptionsRaw impl
Config.ServeOptionsRaw
    (Maybe Port
 -> Maybe HostPreference
 -> ConnParamsRaw
 -> Maybe TxIsolation
 -> Maybe AdminSecretHash
 -> AuthHookRaw
 -> Maybe JWTConfig
 -> Maybe RoleName
 -> Maybe CorsConfig
 -> Bool
 -> Maybe Text
 -> Maybe Bool
 -> Bool
 -> StringifyNumbers
 -> Maybe DangerouslyCollapseBooleans
 -> Maybe (HashSet API)
 -> Maybe RefetchInterval
 -> Maybe BatchSize
 -> Maybe RefetchInterval
 -> Maybe BatchSize
 -> Bool
 -> Maybe (HashSet (EngineLogType impl))
 -> Maybe LogLevel
 -> Bool
 -> Maybe Bool
 -> Maybe PositiveInt
 -> Maybe (NonNegative Milliseconds)
 -> Maybe OptionalInterval
 -> RemoteSchemaPermissions
 -> Bool
 -> Maybe KeepAliveDelay
 -> Maybe InferFunctionPermissions
 -> MaintenanceMode ()
 -> Maybe OptionalInterval
 -> Maybe (HashSet ExperimentalFeature)
 -> Maybe NonNegativeInt
 -> Maybe (NonNegative Seconds)
 -> Maybe WSConnectionInitTimeout
 -> MetadataQueryLoggingMode
 -> Maybe NamingCase
 -> Maybe ExtensionsSchema
 -> ServeOptionsRaw impl)
-> Parser (Maybe Port)
-> Parser
     (Maybe HostPreference
      -> ConnParamsRaw
      -> Maybe TxIsolation
      -> Maybe AdminSecretHash
      -> AuthHookRaw
      -> Maybe JWTConfig
      -> Maybe RoleName
      -> Maybe CorsConfig
      -> Bool
      -> Maybe Text
      -> Maybe Bool
      -> Bool
      -> StringifyNumbers
      -> Maybe DangerouslyCollapseBooleans
      -> Maybe (HashSet API)
      -> Maybe RefetchInterval
      -> Maybe BatchSize
      -> Maybe RefetchInterval
      -> Maybe BatchSize
      -> Bool
      -> Maybe (HashSet (EngineLogType impl))
      -> Maybe LogLevel
      -> Bool
      -> Maybe Bool
      -> Maybe PositiveInt
      -> Maybe (NonNegative Milliseconds)
      -> Maybe OptionalInterval
      -> RemoteSchemaPermissions
      -> Bool
      -> Maybe KeepAliveDelay
      -> Maybe InferFunctionPermissions
      -> MaintenanceMode ()
      -> Maybe OptionalInterval
      -> Maybe (HashSet ExperimentalFeature)
      -> Maybe NonNegativeInt
      -> Maybe (NonNegative Seconds)
      -> Maybe WSConnectionInitTimeout
      -> MetadataQueryLoggingMode
      -> Maybe NamingCase
      -> Maybe ExtensionsSchema
      -> ServeOptionsRaw impl)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser (Maybe Port)
parseServerPort
    Parser
  (Maybe HostPreference
   -> ConnParamsRaw
   -> Maybe TxIsolation
   -> Maybe AdminSecretHash
   -> AuthHookRaw
   -> Maybe JWTConfig
   -> Maybe RoleName
   -> Maybe CorsConfig
   -> Bool
   -> Maybe Text
   -> Maybe Bool
   -> Bool
   -> StringifyNumbers
   -> Maybe DangerouslyCollapseBooleans
   -> Maybe (HashSet API)
   -> Maybe RefetchInterval
   -> Maybe BatchSize
   -> Maybe RefetchInterval
   -> Maybe BatchSize
   -> Bool
   -> Maybe (HashSet (EngineLogType impl))
   -> Maybe LogLevel
   -> Bool
   -> Maybe Bool
   -> Maybe PositiveInt
   -> Maybe (NonNegative Milliseconds)
   -> Maybe OptionalInterval
   -> RemoteSchemaPermissions
   -> Bool
   -> Maybe KeepAliveDelay
   -> Maybe InferFunctionPermissions
   -> MaintenanceMode ()
   -> Maybe OptionalInterval
   -> Maybe (HashSet ExperimentalFeature)
   -> Maybe NonNegativeInt
   -> Maybe (NonNegative Seconds)
   -> Maybe WSConnectionInitTimeout
   -> MetadataQueryLoggingMode
   -> Maybe NamingCase
   -> Maybe ExtensionsSchema
   -> ServeOptionsRaw impl)
-> Parser (Maybe HostPreference)
-> Parser
     (ConnParamsRaw
      -> Maybe TxIsolation
      -> Maybe AdminSecretHash
      -> AuthHookRaw
      -> Maybe JWTConfig
      -> Maybe RoleName
      -> Maybe CorsConfig
      -> Bool
      -> Maybe Text
      -> Maybe Bool
      -> Bool
      -> StringifyNumbers
      -> Maybe DangerouslyCollapseBooleans
      -> Maybe (HashSet API)
      -> Maybe RefetchInterval
      -> Maybe BatchSize
      -> Maybe RefetchInterval
      -> Maybe BatchSize
      -> Bool
      -> Maybe (HashSet (EngineLogType impl))
      -> Maybe LogLevel
      -> Bool
      -> Maybe Bool
      -> Maybe PositiveInt
      -> Maybe (NonNegative Milliseconds)
      -> Maybe OptionalInterval
      -> RemoteSchemaPermissions
      -> Bool
      -> Maybe KeepAliveDelay
      -> Maybe InferFunctionPermissions
      -> MaintenanceMode ()
      -> Maybe OptionalInterval
      -> Maybe (HashSet ExperimentalFeature)
      -> Maybe NonNegativeInt
      -> Maybe (NonNegative Seconds)
      -> Maybe WSConnectionInitTimeout
      -> MetadataQueryLoggingMode
      -> Maybe NamingCase
      -> Maybe ExtensionsSchema
      -> ServeOptionsRaw impl)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (Maybe HostPreference)
parseServerHost
    Parser
  (ConnParamsRaw
   -> Maybe TxIsolation
   -> Maybe AdminSecretHash
   -> AuthHookRaw
   -> Maybe JWTConfig
   -> Maybe RoleName
   -> Maybe CorsConfig
   -> Bool
   -> Maybe Text
   -> Maybe Bool
   -> Bool
   -> StringifyNumbers
   -> Maybe DangerouslyCollapseBooleans
   -> Maybe (HashSet API)
   -> Maybe RefetchInterval
   -> Maybe BatchSize
   -> Maybe RefetchInterval
   -> Maybe BatchSize
   -> Bool
   -> Maybe (HashSet (EngineLogType impl))
   -> Maybe LogLevel
   -> Bool
   -> Maybe Bool
   -> Maybe PositiveInt
   -> Maybe (NonNegative Milliseconds)
   -> Maybe OptionalInterval
   -> RemoteSchemaPermissions
   -> Bool
   -> Maybe KeepAliveDelay
   -> Maybe InferFunctionPermissions
   -> MaintenanceMode ()
   -> Maybe OptionalInterval
   -> Maybe (HashSet ExperimentalFeature)
   -> Maybe NonNegativeInt
   -> Maybe (NonNegative Seconds)
   -> Maybe WSConnectionInitTimeout
   -> MetadataQueryLoggingMode
   -> Maybe NamingCase
   -> Maybe ExtensionsSchema
   -> ServeOptionsRaw impl)
-> Parser ConnParamsRaw
-> Parser
     (Maybe TxIsolation
      -> Maybe AdminSecretHash
      -> AuthHookRaw
      -> Maybe JWTConfig
      -> Maybe RoleName
      -> Maybe CorsConfig
      -> Bool
      -> Maybe Text
      -> Maybe Bool
      -> Bool
      -> StringifyNumbers
      -> Maybe DangerouslyCollapseBooleans
      -> Maybe (HashSet API)
      -> Maybe RefetchInterval
      -> Maybe BatchSize
      -> Maybe RefetchInterval
      -> Maybe BatchSize
      -> Bool
      -> Maybe (HashSet (EngineLogType impl))
      -> Maybe LogLevel
      -> Bool
      -> Maybe Bool
      -> Maybe PositiveInt
      -> Maybe (NonNegative Milliseconds)
      -> Maybe OptionalInterval
      -> RemoteSchemaPermissions
      -> Bool
      -> Maybe KeepAliveDelay
      -> Maybe InferFunctionPermissions
      -> MaintenanceMode ()
      -> Maybe OptionalInterval
      -> Maybe (HashSet ExperimentalFeature)
      -> Maybe NonNegativeInt
      -> Maybe (NonNegative Seconds)
      -> Maybe WSConnectionInitTimeout
      -> MetadataQueryLoggingMode
      -> Maybe NamingCase
      -> Maybe ExtensionsSchema
      -> ServeOptionsRaw impl)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser ConnParamsRaw
parseConnParams
    Parser
  (Maybe TxIsolation
   -> Maybe AdminSecretHash
   -> AuthHookRaw
   -> Maybe JWTConfig
   -> Maybe RoleName
   -> Maybe CorsConfig
   -> Bool
   -> Maybe Text
   -> Maybe Bool
   -> Bool
   -> StringifyNumbers
   -> Maybe DangerouslyCollapseBooleans
   -> Maybe (HashSet API)
   -> Maybe RefetchInterval
   -> Maybe BatchSize
   -> Maybe RefetchInterval
   -> Maybe BatchSize
   -> Bool
   -> Maybe (HashSet (EngineLogType impl))
   -> Maybe LogLevel
   -> Bool
   -> Maybe Bool
   -> Maybe PositiveInt
   -> Maybe (NonNegative Milliseconds)
   -> Maybe OptionalInterval
   -> RemoteSchemaPermissions
   -> Bool
   -> Maybe KeepAliveDelay
   -> Maybe InferFunctionPermissions
   -> MaintenanceMode ()
   -> Maybe OptionalInterval
   -> Maybe (HashSet ExperimentalFeature)
   -> Maybe NonNegativeInt
   -> Maybe (NonNegative Seconds)
   -> Maybe WSConnectionInitTimeout
   -> MetadataQueryLoggingMode
   -> Maybe NamingCase
   -> Maybe ExtensionsSchema
   -> ServeOptionsRaw impl)
-> Parser (Maybe TxIsolation)
-> Parser
     (Maybe AdminSecretHash
      -> AuthHookRaw
      -> Maybe JWTConfig
      -> Maybe RoleName
      -> Maybe CorsConfig
      -> Bool
      -> Maybe Text
      -> Maybe Bool
      -> Bool
      -> StringifyNumbers
      -> Maybe DangerouslyCollapseBooleans
      -> Maybe (HashSet API)
      -> Maybe RefetchInterval
      -> Maybe BatchSize
      -> Maybe RefetchInterval
      -> Maybe BatchSize
      -> Bool
      -> Maybe (HashSet (EngineLogType impl))
      -> Maybe LogLevel
      -> Bool
      -> Maybe Bool
      -> Maybe PositiveInt
      -> Maybe (NonNegative Milliseconds)
      -> Maybe OptionalInterval
      -> RemoteSchemaPermissions
      -> Bool
      -> Maybe KeepAliveDelay
      -> Maybe InferFunctionPermissions
      -> MaintenanceMode ()
      -> Maybe OptionalInterval
      -> Maybe (HashSet ExperimentalFeature)
      -> Maybe NonNegativeInt
      -> Maybe (NonNegative Seconds)
      -> Maybe WSConnectionInitTimeout
      -> MetadataQueryLoggingMode
      -> Maybe NamingCase
      -> Maybe ExtensionsSchema
      -> ServeOptionsRaw impl)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (Maybe TxIsolation)
parseTxIsolation
    Parser
  (Maybe AdminSecretHash
   -> AuthHookRaw
   -> Maybe JWTConfig
   -> Maybe RoleName
   -> Maybe CorsConfig
   -> Bool
   -> Maybe Text
   -> Maybe Bool
   -> Bool
   -> StringifyNumbers
   -> Maybe DangerouslyCollapseBooleans
   -> Maybe (HashSet API)
   -> Maybe RefetchInterval
   -> Maybe BatchSize
   -> Maybe RefetchInterval
   -> Maybe BatchSize
   -> Bool
   -> Maybe (HashSet (EngineLogType impl))
   -> Maybe LogLevel
   -> Bool
   -> Maybe Bool
   -> Maybe PositiveInt
   -> Maybe (NonNegative Milliseconds)
   -> Maybe OptionalInterval
   -> RemoteSchemaPermissions
   -> Bool
   -> Maybe KeepAliveDelay
   -> Maybe InferFunctionPermissions
   -> MaintenanceMode ()
   -> Maybe OptionalInterval
   -> Maybe (HashSet ExperimentalFeature)
   -> Maybe NonNegativeInt
   -> Maybe (NonNegative Seconds)
   -> Maybe WSConnectionInitTimeout
   -> MetadataQueryLoggingMode
   -> Maybe NamingCase
   -> Maybe ExtensionsSchema
   -> ServeOptionsRaw impl)
-> Parser (Maybe AdminSecretHash)
-> Parser
     (AuthHookRaw
      -> Maybe JWTConfig
      -> Maybe RoleName
      -> Maybe CorsConfig
      -> Bool
      -> Maybe Text
      -> Maybe Bool
      -> Bool
      -> StringifyNumbers
      -> Maybe DangerouslyCollapseBooleans
      -> Maybe (HashSet API)
      -> Maybe RefetchInterval
      -> Maybe BatchSize
      -> Maybe RefetchInterval
      -> Maybe BatchSize
      -> Bool
      -> Maybe (HashSet (EngineLogType impl))
      -> Maybe LogLevel
      -> Bool
      -> Maybe Bool
      -> Maybe PositiveInt
      -> Maybe (NonNegative Milliseconds)
      -> Maybe OptionalInterval
      -> RemoteSchemaPermissions
      -> Bool
      -> Maybe KeepAliveDelay
      -> Maybe InferFunctionPermissions
      -> MaintenanceMode ()
      -> Maybe OptionalInterval
      -> Maybe (HashSet ExperimentalFeature)
      -> Maybe NonNegativeInt
      -> Maybe (NonNegative Seconds)
      -> Maybe WSConnectionInitTimeout
      -> MetadataQueryLoggingMode
      -> Maybe NamingCase
      -> Maybe ExtensionsSchema
      -> ServeOptionsRaw impl)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Parser (Maybe AdminSecretHash)
parseAdminSecret Parser (Maybe AdminSecretHash)
-> Parser (Maybe AdminSecretHash) -> Parser (Maybe AdminSecretHash)
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Parser (Maybe AdminSecretHash)
parseAccessKey)
    Parser
  (AuthHookRaw
   -> Maybe JWTConfig
   -> Maybe RoleName
   -> Maybe CorsConfig
   -> Bool
   -> Maybe Text
   -> Maybe Bool
   -> Bool
   -> StringifyNumbers
   -> Maybe DangerouslyCollapseBooleans
   -> Maybe (HashSet API)
   -> Maybe RefetchInterval
   -> Maybe BatchSize
   -> Maybe RefetchInterval
   -> Maybe BatchSize
   -> Bool
   -> Maybe (HashSet (EngineLogType impl))
   -> Maybe LogLevel
   -> Bool
   -> Maybe Bool
   -> Maybe PositiveInt
   -> Maybe (NonNegative Milliseconds)
   -> Maybe OptionalInterval
   -> RemoteSchemaPermissions
   -> Bool
   -> Maybe KeepAliveDelay
   -> Maybe InferFunctionPermissions
   -> MaintenanceMode ()
   -> Maybe OptionalInterval
   -> Maybe (HashSet ExperimentalFeature)
   -> Maybe NonNegativeInt
   -> Maybe (NonNegative Seconds)
   -> Maybe WSConnectionInitTimeout
   -> MetadataQueryLoggingMode
   -> Maybe NamingCase
   -> Maybe ExtensionsSchema
   -> ServeOptionsRaw impl)
-> Parser AuthHookRaw
-> Parser
     (Maybe JWTConfig
      -> Maybe RoleName
      -> Maybe CorsConfig
      -> Bool
      -> Maybe Text
      -> Maybe Bool
      -> Bool
      -> StringifyNumbers
      -> Maybe DangerouslyCollapseBooleans
      -> Maybe (HashSet API)
      -> Maybe RefetchInterval
      -> Maybe BatchSize
      -> Maybe RefetchInterval
      -> Maybe BatchSize
      -> Bool
      -> Maybe (HashSet (EngineLogType impl))
      -> Maybe LogLevel
      -> Bool
      -> Maybe Bool
      -> Maybe PositiveInt
      -> Maybe (NonNegative Milliseconds)
      -> Maybe OptionalInterval
      -> RemoteSchemaPermissions
      -> Bool
      -> Maybe KeepAliveDelay
      -> Maybe InferFunctionPermissions
      -> MaintenanceMode ()
      -> Maybe OptionalInterval
      -> Maybe (HashSet ExperimentalFeature)
      -> Maybe NonNegativeInt
      -> Maybe (NonNegative Seconds)
      -> Maybe WSConnectionInitTimeout
      -> MetadataQueryLoggingMode
      -> Maybe NamingCase
      -> Maybe ExtensionsSchema
      -> ServeOptionsRaw impl)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser AuthHookRaw
parseAuthHook
    Parser
  (Maybe JWTConfig
   -> Maybe RoleName
   -> Maybe CorsConfig
   -> Bool
   -> Maybe Text
   -> Maybe Bool
   -> Bool
   -> StringifyNumbers
   -> Maybe DangerouslyCollapseBooleans
   -> Maybe (HashSet API)
   -> Maybe RefetchInterval
   -> Maybe BatchSize
   -> Maybe RefetchInterval
   -> Maybe BatchSize
   -> Bool
   -> Maybe (HashSet (EngineLogType impl))
   -> Maybe LogLevel
   -> Bool
   -> Maybe Bool
   -> Maybe PositiveInt
   -> Maybe (NonNegative Milliseconds)
   -> Maybe OptionalInterval
   -> RemoteSchemaPermissions
   -> Bool
   -> Maybe KeepAliveDelay
   -> Maybe InferFunctionPermissions
   -> MaintenanceMode ()
   -> Maybe OptionalInterval
   -> Maybe (HashSet ExperimentalFeature)
   -> Maybe NonNegativeInt
   -> Maybe (NonNegative Seconds)
   -> Maybe WSConnectionInitTimeout
   -> MetadataQueryLoggingMode
   -> Maybe NamingCase
   -> Maybe ExtensionsSchema
   -> ServeOptionsRaw impl)
-> Parser (Maybe JWTConfig)
-> Parser
     (Maybe RoleName
      -> Maybe CorsConfig
      -> Bool
      -> Maybe Text
      -> Maybe Bool
      -> Bool
      -> StringifyNumbers
      -> Maybe DangerouslyCollapseBooleans
      -> Maybe (HashSet API)
      -> Maybe RefetchInterval
      -> Maybe BatchSize
      -> Maybe RefetchInterval
      -> Maybe BatchSize
      -> Bool
      -> Maybe (HashSet (EngineLogType impl))
      -> Maybe LogLevel
      -> Bool
      -> Maybe Bool
      -> Maybe PositiveInt
      -> Maybe (NonNegative Milliseconds)
      -> Maybe OptionalInterval
      -> RemoteSchemaPermissions
      -> Bool
      -> Maybe KeepAliveDelay
      -> Maybe InferFunctionPermissions
      -> MaintenanceMode ()
      -> Maybe OptionalInterval
      -> Maybe (HashSet ExperimentalFeature)
      -> Maybe NonNegativeInt
      -> Maybe (NonNegative Seconds)
      -> Maybe WSConnectionInitTimeout
      -> MetadataQueryLoggingMode
      -> Maybe NamingCase
      -> Maybe ExtensionsSchema
      -> ServeOptionsRaw impl)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (Maybe JWTConfig)
parseJwtSecret
    Parser
  (Maybe RoleName
   -> Maybe CorsConfig
   -> Bool
   -> Maybe Text
   -> Maybe Bool
   -> Bool
   -> StringifyNumbers
   -> Maybe DangerouslyCollapseBooleans
   -> Maybe (HashSet API)
   -> Maybe RefetchInterval
   -> Maybe BatchSize
   -> Maybe RefetchInterval
   -> Maybe BatchSize
   -> Bool
   -> Maybe (HashSet (EngineLogType impl))
   -> Maybe LogLevel
   -> Bool
   -> Maybe Bool
   -> Maybe PositiveInt
   -> Maybe (NonNegative Milliseconds)
   -> Maybe OptionalInterval
   -> RemoteSchemaPermissions
   -> Bool
   -> Maybe KeepAliveDelay
   -> Maybe InferFunctionPermissions
   -> MaintenanceMode ()
   -> Maybe OptionalInterval
   -> Maybe (HashSet ExperimentalFeature)
   -> Maybe NonNegativeInt
   -> Maybe (NonNegative Seconds)
   -> Maybe WSConnectionInitTimeout
   -> MetadataQueryLoggingMode
   -> Maybe NamingCase
   -> Maybe ExtensionsSchema
   -> ServeOptionsRaw impl)
-> Parser (Maybe RoleName)
-> Parser
     (Maybe CorsConfig
      -> Bool
      -> Maybe Text
      -> Maybe Bool
      -> Bool
      -> StringifyNumbers
      -> Maybe DangerouslyCollapseBooleans
      -> Maybe (HashSet API)
      -> Maybe RefetchInterval
      -> Maybe BatchSize
      -> Maybe RefetchInterval
      -> Maybe BatchSize
      -> Bool
      -> Maybe (HashSet (EngineLogType impl))
      -> Maybe LogLevel
      -> Bool
      -> Maybe Bool
      -> Maybe PositiveInt
      -> Maybe (NonNegative Milliseconds)
      -> Maybe OptionalInterval
      -> RemoteSchemaPermissions
      -> Bool
      -> Maybe KeepAliveDelay
      -> Maybe InferFunctionPermissions
      -> MaintenanceMode ()
      -> Maybe OptionalInterval
      -> Maybe (HashSet ExperimentalFeature)
      -> Maybe NonNegativeInt
      -> Maybe (NonNegative Seconds)
      -> Maybe WSConnectionInitTimeout
      -> MetadataQueryLoggingMode
      -> Maybe NamingCase
      -> Maybe ExtensionsSchema
      -> ServeOptionsRaw impl)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (Maybe RoleName)
parseUnAuthRole
    Parser
  (Maybe CorsConfig
   -> Bool
   -> Maybe Text
   -> Maybe Bool
   -> Bool
   -> StringifyNumbers
   -> Maybe DangerouslyCollapseBooleans
   -> Maybe (HashSet API)
   -> Maybe RefetchInterval
   -> Maybe BatchSize
   -> Maybe RefetchInterval
   -> Maybe BatchSize
   -> Bool
   -> Maybe (HashSet (EngineLogType impl))
   -> Maybe LogLevel
   -> Bool
   -> Maybe Bool
   -> Maybe PositiveInt
   -> Maybe (NonNegative Milliseconds)
   -> Maybe OptionalInterval
   -> RemoteSchemaPermissions
   -> Bool
   -> Maybe KeepAliveDelay
   -> Maybe InferFunctionPermissions
   -> MaintenanceMode ()
   -> Maybe OptionalInterval
   -> Maybe (HashSet ExperimentalFeature)
   -> Maybe NonNegativeInt
   -> Maybe (NonNegative Seconds)
   -> Maybe WSConnectionInitTimeout
   -> MetadataQueryLoggingMode
   -> Maybe NamingCase
   -> Maybe ExtensionsSchema
   -> ServeOptionsRaw impl)
-> Parser (Maybe CorsConfig)
-> Parser
     (Bool
      -> Maybe Text
      -> Maybe Bool
      -> Bool
      -> StringifyNumbers
      -> Maybe DangerouslyCollapseBooleans
      -> Maybe (HashSet API)
      -> Maybe RefetchInterval
      -> Maybe BatchSize
      -> Maybe RefetchInterval
      -> Maybe BatchSize
      -> Bool
      -> Maybe (HashSet (EngineLogType impl))
      -> Maybe LogLevel
      -> Bool
      -> Maybe Bool
      -> Maybe PositiveInt
      -> Maybe (NonNegative Milliseconds)
      -> Maybe OptionalInterval
      -> RemoteSchemaPermissions
      -> Bool
      -> Maybe KeepAliveDelay
      -> Maybe InferFunctionPermissions
      -> MaintenanceMode ()
      -> Maybe OptionalInterval
      -> Maybe (HashSet ExperimentalFeature)
      -> Maybe NonNegativeInt
      -> Maybe (NonNegative Seconds)
      -> Maybe WSConnectionInitTimeout
      -> MetadataQueryLoggingMode
      -> Maybe NamingCase
      -> Maybe ExtensionsSchema
      -> ServeOptionsRaw impl)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (Maybe CorsConfig)
parseCorsConfig
    Parser
  (Bool
   -> Maybe Text
   -> Maybe Bool
   -> Bool
   -> StringifyNumbers
   -> Maybe DangerouslyCollapseBooleans
   -> Maybe (HashSet API)
   -> Maybe RefetchInterval
   -> Maybe BatchSize
   -> Maybe RefetchInterval
   -> Maybe BatchSize
   -> Bool
   -> Maybe (HashSet (EngineLogType impl))
   -> Maybe LogLevel
   -> Bool
   -> Maybe Bool
   -> Maybe PositiveInt
   -> Maybe (NonNegative Milliseconds)
   -> Maybe OptionalInterval
   -> RemoteSchemaPermissions
   -> Bool
   -> Maybe KeepAliveDelay
   -> Maybe InferFunctionPermissions
   -> MaintenanceMode ()
   -> Maybe OptionalInterval
   -> Maybe (HashSet ExperimentalFeature)
   -> Maybe NonNegativeInt
   -> Maybe (NonNegative Seconds)
   -> Maybe WSConnectionInitTimeout
   -> MetadataQueryLoggingMode
   -> Maybe NamingCase
   -> Maybe ExtensionsSchema
   -> ServeOptionsRaw impl)
-> Parser Bool
-> Parser
     (Maybe Text
      -> Maybe Bool
      -> Bool
      -> StringifyNumbers
      -> Maybe DangerouslyCollapseBooleans
      -> Maybe (HashSet API)
      -> Maybe RefetchInterval
      -> Maybe BatchSize
      -> Maybe RefetchInterval
      -> Maybe BatchSize
      -> Bool
      -> Maybe (HashSet (EngineLogType impl))
      -> Maybe LogLevel
      -> Bool
      -> Maybe Bool
      -> Maybe PositiveInt
      -> Maybe (NonNegative Milliseconds)
      -> Maybe OptionalInterval
      -> RemoteSchemaPermissions
      -> Bool
      -> Maybe KeepAliveDelay
      -> Maybe InferFunctionPermissions
      -> MaintenanceMode ()
      -> Maybe OptionalInterval
      -> Maybe (HashSet ExperimentalFeature)
      -> Maybe NonNegativeInt
      -> Maybe (NonNegative Seconds)
      -> Maybe WSConnectionInitTimeout
      -> MetadataQueryLoggingMode
      -> Maybe NamingCase
      -> Maybe ExtensionsSchema
      -> ServeOptionsRaw impl)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser Bool
parseEnableConsole
    Parser
  (Maybe Text
   -> Maybe Bool
   -> Bool
   -> StringifyNumbers
   -> Maybe DangerouslyCollapseBooleans
   -> Maybe (HashSet API)
   -> Maybe RefetchInterval
   -> Maybe BatchSize
   -> Maybe RefetchInterval
   -> Maybe BatchSize
   -> Bool
   -> Maybe (HashSet (EngineLogType impl))
   -> Maybe LogLevel
   -> Bool
   -> Maybe Bool
   -> Maybe PositiveInt
   -> Maybe (NonNegative Milliseconds)
   -> Maybe OptionalInterval
   -> RemoteSchemaPermissions
   -> Bool
   -> Maybe KeepAliveDelay
   -> Maybe InferFunctionPermissions
   -> MaintenanceMode ()
   -> Maybe OptionalInterval
   -> Maybe (HashSet ExperimentalFeature)
   -> Maybe NonNegativeInt
   -> Maybe (NonNegative Seconds)
   -> Maybe WSConnectionInitTimeout
   -> MetadataQueryLoggingMode
   -> Maybe NamingCase
   -> Maybe ExtensionsSchema
   -> ServeOptionsRaw impl)
-> Parser (Maybe Text)
-> Parser
     (Maybe Bool
      -> Bool
      -> StringifyNumbers
      -> Maybe DangerouslyCollapseBooleans
      -> Maybe (HashSet API)
      -> Maybe RefetchInterval
      -> Maybe BatchSize
      -> Maybe RefetchInterval
      -> Maybe BatchSize
      -> Bool
      -> Maybe (HashSet (EngineLogType impl))
      -> Maybe LogLevel
      -> Bool
      -> Maybe Bool
      -> Maybe PositiveInt
      -> Maybe (NonNegative Milliseconds)
      -> Maybe OptionalInterval
      -> RemoteSchemaPermissions
      -> Bool
      -> Maybe KeepAliveDelay
      -> Maybe InferFunctionPermissions
      -> MaintenanceMode ()
      -> Maybe OptionalInterval
      -> Maybe (HashSet ExperimentalFeature)
      -> Maybe NonNegativeInt
      -> Maybe (NonNegative Seconds)
      -> Maybe WSConnectionInitTimeout
      -> MetadataQueryLoggingMode
      -> Maybe NamingCase
      -> Maybe ExtensionsSchema
      -> ServeOptionsRaw impl)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (Maybe Text)
parseConsoleAssetsDir
    Parser
  (Maybe Bool
   -> Bool
   -> StringifyNumbers
   -> Maybe DangerouslyCollapseBooleans
   -> Maybe (HashSet API)
   -> Maybe RefetchInterval
   -> Maybe BatchSize
   -> Maybe RefetchInterval
   -> Maybe BatchSize
   -> Bool
   -> Maybe (HashSet (EngineLogType impl))
   -> Maybe LogLevel
   -> Bool
   -> Maybe Bool
   -> Maybe PositiveInt
   -> Maybe (NonNegative Milliseconds)
   -> Maybe OptionalInterval
   -> RemoteSchemaPermissions
   -> Bool
   -> Maybe KeepAliveDelay
   -> Maybe InferFunctionPermissions
   -> MaintenanceMode ()
   -> Maybe OptionalInterval
   -> Maybe (HashSet ExperimentalFeature)
   -> Maybe NonNegativeInt
   -> Maybe (NonNegative Seconds)
   -> Maybe WSConnectionInitTimeout
   -> MetadataQueryLoggingMode
   -> Maybe NamingCase
   -> Maybe ExtensionsSchema
   -> ServeOptionsRaw impl)
-> Parser (Maybe Bool)
-> Parser
     (Bool
      -> StringifyNumbers
      -> Maybe DangerouslyCollapseBooleans
      -> Maybe (HashSet API)
      -> Maybe RefetchInterval
      -> Maybe BatchSize
      -> Maybe RefetchInterval
      -> Maybe BatchSize
      -> Bool
      -> Maybe (HashSet (EngineLogType impl))
      -> Maybe LogLevel
      -> Bool
      -> Maybe Bool
      -> Maybe PositiveInt
      -> Maybe (NonNegative Milliseconds)
      -> Maybe OptionalInterval
      -> RemoteSchemaPermissions
      -> Bool
      -> Maybe KeepAliveDelay
      -> Maybe InferFunctionPermissions
      -> MaintenanceMode ()
      -> Maybe OptionalInterval
      -> Maybe (HashSet ExperimentalFeature)
      -> Maybe NonNegativeInt
      -> Maybe (NonNegative Seconds)
      -> Maybe WSConnectionInitTimeout
      -> MetadataQueryLoggingMode
      -> Maybe NamingCase
      -> Maybe ExtensionsSchema
      -> ServeOptionsRaw impl)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (Maybe Bool)
parseEnableTelemetry
    Parser
  (Bool
   -> StringifyNumbers
   -> Maybe DangerouslyCollapseBooleans
   -> Maybe (HashSet API)
   -> Maybe RefetchInterval
   -> Maybe BatchSize
   -> Maybe RefetchInterval
   -> Maybe BatchSize
   -> Bool
   -> Maybe (HashSet (EngineLogType impl))
   -> Maybe LogLevel
   -> Bool
   -> Maybe Bool
   -> Maybe PositiveInt
   -> Maybe (NonNegative Milliseconds)
   -> Maybe OptionalInterval
   -> RemoteSchemaPermissions
   -> Bool
   -> Maybe KeepAliveDelay
   -> Maybe InferFunctionPermissions
   -> MaintenanceMode ()
   -> Maybe OptionalInterval
   -> Maybe (HashSet ExperimentalFeature)
   -> Maybe NonNegativeInt
   -> Maybe (NonNegative Seconds)
   -> Maybe WSConnectionInitTimeout
   -> MetadataQueryLoggingMode
   -> Maybe NamingCase
   -> Maybe ExtensionsSchema
   -> ServeOptionsRaw impl)
-> Parser Bool
-> Parser
     (StringifyNumbers
      -> Maybe DangerouslyCollapseBooleans
      -> Maybe (HashSet API)
      -> Maybe RefetchInterval
      -> Maybe BatchSize
      -> Maybe RefetchInterval
      -> Maybe BatchSize
      -> Bool
      -> Maybe (HashSet (EngineLogType impl))
      -> Maybe LogLevel
      -> Bool
      -> Maybe Bool
      -> Maybe PositiveInt
      -> Maybe (NonNegative Milliseconds)
      -> Maybe OptionalInterval
      -> RemoteSchemaPermissions
      -> Bool
      -> Maybe KeepAliveDelay
      -> Maybe InferFunctionPermissions
      -> MaintenanceMode ()
      -> Maybe OptionalInterval
      -> Maybe (HashSet ExperimentalFeature)
      -> Maybe NonNegativeInt
      -> Maybe (NonNegative Seconds)
      -> Maybe WSConnectionInitTimeout
      -> MetadataQueryLoggingMode
      -> Maybe NamingCase
      -> Maybe ExtensionsSchema
      -> ServeOptionsRaw impl)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser Bool
parseWsReadCookie
    Parser
  (StringifyNumbers
   -> Maybe DangerouslyCollapseBooleans
   -> Maybe (HashSet API)
   -> Maybe RefetchInterval
   -> Maybe BatchSize
   -> Maybe RefetchInterval
   -> Maybe BatchSize
   -> Bool
   -> Maybe (HashSet (EngineLogType impl))
   -> Maybe LogLevel
   -> Bool
   -> Maybe Bool
   -> Maybe PositiveInt
   -> Maybe (NonNegative Milliseconds)
   -> Maybe OptionalInterval
   -> RemoteSchemaPermissions
   -> Bool
   -> Maybe KeepAliveDelay
   -> Maybe InferFunctionPermissions
   -> MaintenanceMode ()
   -> Maybe OptionalInterval
   -> Maybe (HashSet ExperimentalFeature)
   -> Maybe NonNegativeInt
   -> Maybe (NonNegative Seconds)
   -> Maybe WSConnectionInitTimeout
   -> MetadataQueryLoggingMode
   -> Maybe NamingCase
   -> Maybe ExtensionsSchema
   -> ServeOptionsRaw impl)
-> Parser StringifyNumbers
-> Parser
     (Maybe DangerouslyCollapseBooleans
      -> Maybe (HashSet API)
      -> Maybe RefetchInterval
      -> Maybe BatchSize
      -> Maybe RefetchInterval
      -> Maybe BatchSize
      -> Bool
      -> Maybe (HashSet (EngineLogType impl))
      -> Maybe LogLevel
      -> Bool
      -> Maybe Bool
      -> Maybe PositiveInt
      -> Maybe (NonNegative Milliseconds)
      -> Maybe OptionalInterval
      -> RemoteSchemaPermissions
      -> Bool
      -> Maybe KeepAliveDelay
      -> Maybe InferFunctionPermissions
      -> MaintenanceMode ()
      -> Maybe OptionalInterval
      -> Maybe (HashSet ExperimentalFeature)
      -> Maybe NonNegativeInt
      -> Maybe (NonNegative Seconds)
      -> Maybe WSConnectionInitTimeout
      -> MetadataQueryLoggingMode
      -> Maybe NamingCase
      -> Maybe ExtensionsSchema
      -> ServeOptionsRaw impl)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser StringifyNumbers
parseStringifyNum
    Parser
  (Maybe DangerouslyCollapseBooleans
   -> Maybe (HashSet API)
   -> Maybe RefetchInterval
   -> Maybe BatchSize
   -> Maybe RefetchInterval
   -> Maybe BatchSize
   -> Bool
   -> Maybe (HashSet (EngineLogType impl))
   -> Maybe LogLevel
   -> Bool
   -> Maybe Bool
   -> Maybe PositiveInt
   -> Maybe (NonNegative Milliseconds)
   -> Maybe OptionalInterval
   -> RemoteSchemaPermissions
   -> Bool
   -> Maybe KeepAliveDelay
   -> Maybe InferFunctionPermissions
   -> MaintenanceMode ()
   -> Maybe OptionalInterval
   -> Maybe (HashSet ExperimentalFeature)
   -> Maybe NonNegativeInt
   -> Maybe (NonNegative Seconds)
   -> Maybe WSConnectionInitTimeout
   -> MetadataQueryLoggingMode
   -> Maybe NamingCase
   -> Maybe ExtensionsSchema
   -> ServeOptionsRaw impl)
-> Parser (Maybe DangerouslyCollapseBooleans)
-> Parser
     (Maybe (HashSet API)
      -> Maybe RefetchInterval
      -> Maybe BatchSize
      -> Maybe RefetchInterval
      -> Maybe BatchSize
      -> Bool
      -> Maybe (HashSet (EngineLogType impl))
      -> Maybe LogLevel
      -> Bool
      -> Maybe Bool
      -> Maybe PositiveInt
      -> Maybe (NonNegative Milliseconds)
      -> Maybe OptionalInterval
      -> RemoteSchemaPermissions
      -> Bool
      -> Maybe KeepAliveDelay
      -> Maybe InferFunctionPermissions
      -> MaintenanceMode ()
      -> Maybe OptionalInterval
      -> Maybe (HashSet ExperimentalFeature)
      -> Maybe NonNegativeInt
      -> Maybe (NonNegative Seconds)
      -> Maybe WSConnectionInitTimeout
      -> MetadataQueryLoggingMode
      -> Maybe NamingCase
      -> Maybe ExtensionsSchema
      -> ServeOptionsRaw impl)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (Maybe DangerouslyCollapseBooleans)
parseDangerousBooleanCollapse
    Parser
  (Maybe (HashSet API)
   -> Maybe RefetchInterval
   -> Maybe BatchSize
   -> Maybe RefetchInterval
   -> Maybe BatchSize
   -> Bool
   -> Maybe (HashSet (EngineLogType impl))
   -> Maybe LogLevel
   -> Bool
   -> Maybe Bool
   -> Maybe PositiveInt
   -> Maybe (NonNegative Milliseconds)
   -> Maybe OptionalInterval
   -> RemoteSchemaPermissions
   -> Bool
   -> Maybe KeepAliveDelay
   -> Maybe InferFunctionPermissions
   -> MaintenanceMode ()
   -> Maybe OptionalInterval
   -> Maybe (HashSet ExperimentalFeature)
   -> Maybe NonNegativeInt
   -> Maybe (NonNegative Seconds)
   -> Maybe WSConnectionInitTimeout
   -> MetadataQueryLoggingMode
   -> Maybe NamingCase
   -> Maybe ExtensionsSchema
   -> ServeOptionsRaw impl)
-> Parser (Maybe (HashSet API))
-> Parser
     (Maybe RefetchInterval
      -> Maybe BatchSize
      -> Maybe RefetchInterval
      -> Maybe BatchSize
      -> Bool
      -> Maybe (HashSet (EngineLogType impl))
      -> Maybe LogLevel
      -> Bool
      -> Maybe Bool
      -> Maybe PositiveInt
      -> Maybe (NonNegative Milliseconds)
      -> Maybe OptionalInterval
      -> RemoteSchemaPermissions
      -> Bool
      -> Maybe KeepAliveDelay
      -> Maybe InferFunctionPermissions
      -> MaintenanceMode ()
      -> Maybe OptionalInterval
      -> Maybe (HashSet ExperimentalFeature)
      -> Maybe NonNegativeInt
      -> Maybe (NonNegative Seconds)
      -> Maybe WSConnectionInitTimeout
      -> MetadataQueryLoggingMode
      -> Maybe NamingCase
      -> Maybe ExtensionsSchema
      -> ServeOptionsRaw impl)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (Maybe (HashSet API))
parseEnabledAPIs
    Parser
  (Maybe RefetchInterval
   -> Maybe BatchSize
   -> Maybe RefetchInterval
   -> Maybe BatchSize
   -> Bool
   -> Maybe (HashSet (EngineLogType impl))
   -> Maybe LogLevel
   -> Bool
   -> Maybe Bool
   -> Maybe PositiveInt
   -> Maybe (NonNegative Milliseconds)
   -> Maybe OptionalInterval
   -> RemoteSchemaPermissions
   -> Bool
   -> Maybe KeepAliveDelay
   -> Maybe InferFunctionPermissions
   -> MaintenanceMode ()
   -> Maybe OptionalInterval
   -> Maybe (HashSet ExperimentalFeature)
   -> Maybe NonNegativeInt
   -> Maybe (NonNegative Seconds)
   -> Maybe WSConnectionInitTimeout
   -> MetadataQueryLoggingMode
   -> Maybe NamingCase
   -> Maybe ExtensionsSchema
   -> ServeOptionsRaw impl)
-> Parser (Maybe RefetchInterval)
-> Parser
     (Maybe BatchSize
      -> Maybe RefetchInterval
      -> Maybe BatchSize
      -> Bool
      -> Maybe (HashSet (EngineLogType impl))
      -> Maybe LogLevel
      -> Bool
      -> Maybe Bool
      -> Maybe PositiveInt
      -> Maybe (NonNegative Milliseconds)
      -> Maybe OptionalInterval
      -> RemoteSchemaPermissions
      -> Bool
      -> Maybe KeepAliveDelay
      -> Maybe InferFunctionPermissions
      -> MaintenanceMode ()
      -> Maybe OptionalInterval
      -> Maybe (HashSet ExperimentalFeature)
      -> Maybe NonNegativeInt
      -> Maybe (NonNegative Seconds)
      -> Maybe WSConnectionInitTimeout
      -> MetadataQueryLoggingMode
      -> Maybe NamingCase
      -> Maybe ExtensionsSchema
      -> ServeOptionsRaw impl)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (Maybe RefetchInterval)
parseMxRefetchDelay
    Parser
  (Maybe BatchSize
   -> Maybe RefetchInterval
   -> Maybe BatchSize
   -> Bool
   -> Maybe (HashSet (EngineLogType impl))
   -> Maybe LogLevel
   -> Bool
   -> Maybe Bool
   -> Maybe PositiveInt
   -> Maybe (NonNegative Milliseconds)
   -> Maybe OptionalInterval
   -> RemoteSchemaPermissions
   -> Bool
   -> Maybe KeepAliveDelay
   -> Maybe InferFunctionPermissions
   -> MaintenanceMode ()
   -> Maybe OptionalInterval
   -> Maybe (HashSet ExperimentalFeature)
   -> Maybe NonNegativeInt
   -> Maybe (NonNegative Seconds)
   -> Maybe WSConnectionInitTimeout
   -> MetadataQueryLoggingMode
   -> Maybe NamingCase
   -> Maybe ExtensionsSchema
   -> ServeOptionsRaw impl)
-> Parser (Maybe BatchSize)
-> Parser
     (Maybe RefetchInterval
      -> Maybe BatchSize
      -> Bool
      -> Maybe (HashSet (EngineLogType impl))
      -> Maybe LogLevel
      -> Bool
      -> Maybe Bool
      -> Maybe PositiveInt
      -> Maybe (NonNegative Milliseconds)
      -> Maybe OptionalInterval
      -> RemoteSchemaPermissions
      -> Bool
      -> Maybe KeepAliveDelay
      -> Maybe InferFunctionPermissions
      -> MaintenanceMode ()
      -> Maybe OptionalInterval
      -> Maybe (HashSet ExperimentalFeature)
      -> Maybe NonNegativeInt
      -> Maybe (NonNegative Seconds)
      -> Maybe WSConnectionInitTimeout
      -> MetadataQueryLoggingMode
      -> Maybe NamingCase
      -> Maybe ExtensionsSchema
      -> ServeOptionsRaw impl)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (Maybe BatchSize)
parseMxBatchSize
    Parser
  (Maybe RefetchInterval
   -> Maybe BatchSize
   -> Bool
   -> Maybe (HashSet (EngineLogType impl))
   -> Maybe LogLevel
   -> Bool
   -> Maybe Bool
   -> Maybe PositiveInt
   -> Maybe (NonNegative Milliseconds)
   -> Maybe OptionalInterval
   -> RemoteSchemaPermissions
   -> Bool
   -> Maybe KeepAliveDelay
   -> Maybe InferFunctionPermissions
   -> MaintenanceMode ()
   -> Maybe OptionalInterval
   -> Maybe (HashSet ExperimentalFeature)
   -> Maybe NonNegativeInt
   -> Maybe (NonNegative Seconds)
   -> Maybe WSConnectionInitTimeout
   -> MetadataQueryLoggingMode
   -> Maybe NamingCase
   -> Maybe ExtensionsSchema
   -> ServeOptionsRaw impl)
-> Parser (Maybe RefetchInterval)
-> Parser
     (Maybe BatchSize
      -> Bool
      -> Maybe (HashSet (EngineLogType impl))
      -> Maybe LogLevel
      -> Bool
      -> Maybe Bool
      -> Maybe PositiveInt
      -> Maybe (NonNegative Milliseconds)
      -> Maybe OptionalInterval
      -> RemoteSchemaPermissions
      -> Bool
      -> Maybe KeepAliveDelay
      -> Maybe InferFunctionPermissions
      -> MaintenanceMode ()
      -> Maybe OptionalInterval
      -> Maybe (HashSet ExperimentalFeature)
      -> Maybe NonNegativeInt
      -> Maybe (NonNegative Seconds)
      -> Maybe WSConnectionInitTimeout
      -> MetadataQueryLoggingMode
      -> Maybe NamingCase
      -> Maybe ExtensionsSchema
      -> ServeOptionsRaw impl)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (Maybe RefetchInterval)
parseStreamingMxRefetchDelay
    Parser
  (Maybe BatchSize
   -> Bool
   -> Maybe (HashSet (EngineLogType impl))
   -> Maybe LogLevel
   -> Bool
   -> Maybe Bool
   -> Maybe PositiveInt
   -> Maybe (NonNegative Milliseconds)
   -> Maybe OptionalInterval
   -> RemoteSchemaPermissions
   -> Bool
   -> Maybe KeepAliveDelay
   -> Maybe InferFunctionPermissions
   -> MaintenanceMode ()
   -> Maybe OptionalInterval
   -> Maybe (HashSet ExperimentalFeature)
   -> Maybe NonNegativeInt
   -> Maybe (NonNegative Seconds)
   -> Maybe WSConnectionInitTimeout
   -> MetadataQueryLoggingMode
   -> Maybe NamingCase
   -> Maybe ExtensionsSchema
   -> ServeOptionsRaw impl)
-> Parser (Maybe BatchSize)
-> Parser
     (Bool
      -> Maybe (HashSet (EngineLogType impl))
      -> Maybe LogLevel
      -> Bool
      -> Maybe Bool
      -> Maybe PositiveInt
      -> Maybe (NonNegative Milliseconds)
      -> Maybe OptionalInterval
      -> RemoteSchemaPermissions
      -> Bool
      -> Maybe KeepAliveDelay
      -> Maybe InferFunctionPermissions
      -> MaintenanceMode ()
      -> Maybe OptionalInterval
      -> Maybe (HashSet ExperimentalFeature)
      -> Maybe NonNegativeInt
      -> Maybe (NonNegative Seconds)
      -> Maybe WSConnectionInitTimeout
      -> MetadataQueryLoggingMode
      -> Maybe NamingCase
      -> Maybe ExtensionsSchema
      -> ServeOptionsRaw impl)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (Maybe BatchSize)
parseStreamingMxBatchSize
    Parser
  (Bool
   -> Maybe (HashSet (EngineLogType impl))
   -> Maybe LogLevel
   -> Bool
   -> Maybe Bool
   -> Maybe PositiveInt
   -> Maybe (NonNegative Milliseconds)
   -> Maybe OptionalInterval
   -> RemoteSchemaPermissions
   -> Bool
   -> Maybe KeepAliveDelay
   -> Maybe InferFunctionPermissions
   -> MaintenanceMode ()
   -> Maybe OptionalInterval
   -> Maybe (HashSet ExperimentalFeature)
   -> Maybe NonNegativeInt
   -> Maybe (NonNegative Seconds)
   -> Maybe WSConnectionInitTimeout
   -> MetadataQueryLoggingMode
   -> Maybe NamingCase
   -> Maybe ExtensionsSchema
   -> ServeOptionsRaw impl)
-> Parser Bool
-> Parser
     (Maybe (HashSet (EngineLogType impl))
      -> Maybe LogLevel
      -> Bool
      -> Maybe Bool
      -> Maybe PositiveInt
      -> Maybe (NonNegative Milliseconds)
      -> Maybe OptionalInterval
      -> RemoteSchemaPermissions
      -> Bool
      -> Maybe KeepAliveDelay
      -> Maybe InferFunctionPermissions
      -> MaintenanceMode ()
      -> Maybe OptionalInterval
      -> Maybe (HashSet ExperimentalFeature)
      -> Maybe NonNegativeInt
      -> Maybe (NonNegative Seconds)
      -> Maybe WSConnectionInitTimeout
      -> MetadataQueryLoggingMode
      -> Maybe NamingCase
      -> Maybe ExtensionsSchema
      -> ServeOptionsRaw impl)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser Bool
parseEnableAllowlist
    Parser
  (Maybe (HashSet (EngineLogType impl))
   -> Maybe LogLevel
   -> Bool
   -> Maybe Bool
   -> Maybe PositiveInt
   -> Maybe (NonNegative Milliseconds)
   -> Maybe OptionalInterval
   -> RemoteSchemaPermissions
   -> Bool
   -> Maybe KeepAliveDelay
   -> Maybe InferFunctionPermissions
   -> MaintenanceMode ()
   -> Maybe OptionalInterval
   -> Maybe (HashSet ExperimentalFeature)
   -> Maybe NonNegativeInt
   -> Maybe (NonNegative Seconds)
   -> Maybe WSConnectionInitTimeout
   -> MetadataQueryLoggingMode
   -> Maybe NamingCase
   -> Maybe ExtensionsSchema
   -> ServeOptionsRaw impl)
-> Parser (Maybe (HashSet (EngineLogType impl)))
-> Parser
     (Maybe LogLevel
      -> Bool
      -> Maybe Bool
      -> Maybe PositiveInt
      -> Maybe (NonNegative Milliseconds)
      -> Maybe OptionalInterval
      -> RemoteSchemaPermissions
      -> Bool
      -> Maybe KeepAliveDelay
      -> Maybe InferFunctionPermissions
      -> MaintenanceMode ()
      -> Maybe OptionalInterval
      -> Maybe (HashSet ExperimentalFeature)
      -> Maybe NonNegativeInt
      -> Maybe (NonNegative Seconds)
      -> Maybe WSConnectionInitTimeout
      -> MetadataQueryLoggingMode
      -> Maybe NamingCase
      -> Maybe ExtensionsSchema
      -> ServeOptionsRaw impl)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (Maybe (HashSet (EngineLogType impl)))
forall impl.
EnabledLogTypes impl =>
Parser (Maybe (HashSet (EngineLogType impl)))
parseEnabledLogs
    Parser
  (Maybe LogLevel
   -> Bool
   -> Maybe Bool
   -> Maybe PositiveInt
   -> Maybe (NonNegative Milliseconds)
   -> Maybe OptionalInterval
   -> RemoteSchemaPermissions
   -> Bool
   -> Maybe KeepAliveDelay
   -> Maybe InferFunctionPermissions
   -> MaintenanceMode ()
   -> Maybe OptionalInterval
   -> Maybe (HashSet ExperimentalFeature)
   -> Maybe NonNegativeInt
   -> Maybe (NonNegative Seconds)
   -> Maybe WSConnectionInitTimeout
   -> MetadataQueryLoggingMode
   -> Maybe NamingCase
   -> Maybe ExtensionsSchema
   -> ServeOptionsRaw impl)
-> Parser (Maybe LogLevel)
-> Parser
     (Bool
      -> Maybe Bool
      -> Maybe PositiveInt
      -> Maybe (NonNegative Milliseconds)
      -> Maybe OptionalInterval
      -> RemoteSchemaPermissions
      -> Bool
      -> Maybe KeepAliveDelay
      -> Maybe InferFunctionPermissions
      -> MaintenanceMode ()
      -> Maybe OptionalInterval
      -> Maybe (HashSet ExperimentalFeature)
      -> Maybe NonNegativeInt
      -> Maybe (NonNegative Seconds)
      -> Maybe WSConnectionInitTimeout
      -> MetadataQueryLoggingMode
      -> Maybe NamingCase
      -> Maybe ExtensionsSchema
      -> ServeOptionsRaw impl)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (Maybe LogLevel)
parseLogLevel
    Parser
  (Bool
   -> Maybe Bool
   -> Maybe PositiveInt
   -> Maybe (NonNegative Milliseconds)
   -> Maybe OptionalInterval
   -> RemoteSchemaPermissions
   -> Bool
   -> Maybe KeepAliveDelay
   -> Maybe InferFunctionPermissions
   -> MaintenanceMode ()
   -> Maybe OptionalInterval
   -> Maybe (HashSet ExperimentalFeature)
   -> Maybe NonNegativeInt
   -> Maybe (NonNegative Seconds)
   -> Maybe WSConnectionInitTimeout
   -> MetadataQueryLoggingMode
   -> Maybe NamingCase
   -> Maybe ExtensionsSchema
   -> ServeOptionsRaw impl)
-> Parser (Maybe CacheSize)
-> Parser
     (Bool
      -> Maybe Bool
      -> Maybe PositiveInt
      -> Maybe (NonNegative Milliseconds)
      -> Maybe OptionalInterval
      -> RemoteSchemaPermissions
      -> Bool
      -> Maybe KeepAliveDelay
      -> Maybe InferFunctionPermissions
      -> MaintenanceMode ()
      -> Maybe OptionalInterval
      -> Maybe (HashSet ExperimentalFeature)
      -> Maybe NonNegativeInt
      -> Maybe (NonNegative Seconds)
      -> Maybe WSConnectionInitTimeout
      -> MetadataQueryLoggingMode
      -> Maybe NamingCase
      -> Maybe ExtensionsSchema
      -> ServeOptionsRaw impl)
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* Parser (Maybe CacheSize)
parsePlanCacheSize -- parsed (for backwards compatibility reasons) but ignored
    Parser
  (Bool
   -> Maybe Bool
   -> Maybe PositiveInt
   -> Maybe (NonNegative Milliseconds)
   -> Maybe OptionalInterval
   -> RemoteSchemaPermissions
   -> Bool
   -> Maybe KeepAliveDelay
   -> Maybe InferFunctionPermissions
   -> MaintenanceMode ()
   -> Maybe OptionalInterval
   -> Maybe (HashSet ExperimentalFeature)
   -> Maybe NonNegativeInt
   -> Maybe (NonNegative Seconds)
   -> Maybe WSConnectionInitTimeout
   -> MetadataQueryLoggingMode
   -> Maybe NamingCase
   -> Maybe ExtensionsSchema
   -> ServeOptionsRaw impl)
-> Parser Bool
-> Parser
     (Maybe Bool
      -> Maybe PositiveInt
      -> Maybe (NonNegative Milliseconds)
      -> Maybe OptionalInterval
      -> RemoteSchemaPermissions
      -> Bool
      -> Maybe KeepAliveDelay
      -> Maybe InferFunctionPermissions
      -> MaintenanceMode ()
      -> Maybe OptionalInterval
      -> Maybe (HashSet ExperimentalFeature)
      -> Maybe NonNegativeInt
      -> Maybe (NonNegative Seconds)
      -> Maybe WSConnectionInitTimeout
      -> MetadataQueryLoggingMode
      -> Maybe NamingCase
      -> Maybe ExtensionsSchema
      -> ServeOptionsRaw impl)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser Bool
parseGraphqlDevMode
    Parser
  (Maybe Bool
   -> Maybe PositiveInt
   -> Maybe (NonNegative Milliseconds)
   -> Maybe OptionalInterval
   -> RemoteSchemaPermissions
   -> Bool
   -> Maybe KeepAliveDelay
   -> Maybe InferFunctionPermissions
   -> MaintenanceMode ()
   -> Maybe OptionalInterval
   -> Maybe (HashSet ExperimentalFeature)
   -> Maybe NonNegativeInt
   -> Maybe (NonNegative Seconds)
   -> Maybe WSConnectionInitTimeout
   -> MetadataQueryLoggingMode
   -> Maybe NamingCase
   -> Maybe ExtensionsSchema
   -> ServeOptionsRaw impl)
-> Parser (Maybe Bool)
-> Parser
     (Maybe PositiveInt
      -> Maybe (NonNegative Milliseconds)
      -> Maybe OptionalInterval
      -> RemoteSchemaPermissions
      -> Bool
      -> Maybe KeepAliveDelay
      -> Maybe InferFunctionPermissions
      -> MaintenanceMode ()
      -> Maybe OptionalInterval
      -> Maybe (HashSet ExperimentalFeature)
      -> Maybe NonNegativeInt
      -> Maybe (NonNegative Seconds)
      -> Maybe WSConnectionInitTimeout
      -> MetadataQueryLoggingMode
      -> Maybe NamingCase
      -> Maybe ExtensionsSchema
      -> ServeOptionsRaw impl)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (Maybe Bool)
parseGraphqlAdminInternalErrors
    Parser
  (Maybe PositiveInt
   -> Maybe (NonNegative Milliseconds)
   -> Maybe OptionalInterval
   -> RemoteSchemaPermissions
   -> Bool
   -> Maybe KeepAliveDelay
   -> Maybe InferFunctionPermissions
   -> MaintenanceMode ()
   -> Maybe OptionalInterval
   -> Maybe (HashSet ExperimentalFeature)
   -> Maybe NonNegativeInt
   -> Maybe (NonNegative Seconds)
   -> Maybe WSConnectionInitTimeout
   -> MetadataQueryLoggingMode
   -> Maybe NamingCase
   -> Maybe ExtensionsSchema
   -> ServeOptionsRaw impl)
-> Parser (Maybe PositiveInt)
-> Parser
     (Maybe (NonNegative Milliseconds)
      -> Maybe OptionalInterval
      -> RemoteSchemaPermissions
      -> Bool
      -> Maybe KeepAliveDelay
      -> Maybe InferFunctionPermissions
      -> MaintenanceMode ()
      -> Maybe OptionalInterval
      -> Maybe (HashSet ExperimentalFeature)
      -> Maybe NonNegativeInt
      -> Maybe (NonNegative Seconds)
      -> Maybe WSConnectionInitTimeout
      -> MetadataQueryLoggingMode
      -> Maybe NamingCase
      -> Maybe ExtensionsSchema
      -> ServeOptionsRaw impl)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (Maybe PositiveInt)
parseGraphqlEventsHttpPoolSize
    Parser
  (Maybe (NonNegative Milliseconds)
   -> Maybe OptionalInterval
   -> RemoteSchemaPermissions
   -> Bool
   -> Maybe KeepAliveDelay
   -> Maybe InferFunctionPermissions
   -> MaintenanceMode ()
   -> Maybe OptionalInterval
   -> Maybe (HashSet ExperimentalFeature)
   -> Maybe NonNegativeInt
   -> Maybe (NonNegative Seconds)
   -> Maybe WSConnectionInitTimeout
   -> MetadataQueryLoggingMode
   -> Maybe NamingCase
   -> Maybe ExtensionsSchema
   -> ServeOptionsRaw impl)
-> Parser (Maybe (NonNegative Milliseconds))
-> Parser
     (Maybe OptionalInterval
      -> RemoteSchemaPermissions
      -> Bool
      -> Maybe KeepAliveDelay
      -> Maybe InferFunctionPermissions
      -> MaintenanceMode ()
      -> Maybe OptionalInterval
      -> Maybe (HashSet ExperimentalFeature)
      -> Maybe NonNegativeInt
      -> Maybe (NonNegative Seconds)
      -> Maybe WSConnectionInitTimeout
      -> MetadataQueryLoggingMode
      -> Maybe NamingCase
      -> Maybe ExtensionsSchema
      -> ServeOptionsRaw impl)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (Maybe (NonNegative Milliseconds))
parseGraphqlEventsFetchInterval
    Parser
  (Maybe OptionalInterval
   -> RemoteSchemaPermissions
   -> Bool
   -> Maybe KeepAliveDelay
   -> Maybe InferFunctionPermissions
   -> MaintenanceMode ()
   -> Maybe OptionalInterval
   -> Maybe (HashSet ExperimentalFeature)
   -> Maybe NonNegativeInt
   -> Maybe (NonNegative Seconds)
   -> Maybe WSConnectionInitTimeout
   -> MetadataQueryLoggingMode
   -> Maybe NamingCase
   -> Maybe ExtensionsSchema
   -> ServeOptionsRaw impl)
-> Parser (Maybe OptionalInterval)
-> Parser
     (RemoteSchemaPermissions
      -> Bool
      -> Maybe KeepAliveDelay
      -> Maybe InferFunctionPermissions
      -> MaintenanceMode ()
      -> Maybe OptionalInterval
      -> Maybe (HashSet ExperimentalFeature)
      -> Maybe NonNegativeInt
      -> Maybe (NonNegative Seconds)
      -> Maybe WSConnectionInitTimeout
      -> MetadataQueryLoggingMode
      -> Maybe NamingCase
      -> Maybe ExtensionsSchema
      -> ServeOptionsRaw impl)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (Maybe OptionalInterval)
parseGraphqlAsyncActionsFetchInterval
    Parser
  (RemoteSchemaPermissions
   -> Bool
   -> Maybe KeepAliveDelay
   -> Maybe InferFunctionPermissions
   -> MaintenanceMode ()
   -> Maybe OptionalInterval
   -> Maybe (HashSet ExperimentalFeature)
   -> Maybe NonNegativeInt
   -> Maybe (NonNegative Seconds)
   -> Maybe WSConnectionInitTimeout
   -> MetadataQueryLoggingMode
   -> Maybe NamingCase
   -> Maybe ExtensionsSchema
   -> ServeOptionsRaw impl)
-> Parser RemoteSchemaPermissions
-> Parser
     (Bool
      -> Maybe KeepAliveDelay
      -> Maybe InferFunctionPermissions
      -> MaintenanceMode ()
      -> Maybe OptionalInterval
      -> Maybe (HashSet ExperimentalFeature)
      -> Maybe NonNegativeInt
      -> Maybe (NonNegative Seconds)
      -> Maybe WSConnectionInitTimeout
      -> MetadataQueryLoggingMode
      -> Maybe NamingCase
      -> Maybe ExtensionsSchema
      -> ServeOptionsRaw impl)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser RemoteSchemaPermissions
parseEnableRemoteSchemaPerms
    Parser
  (Bool
   -> Maybe KeepAliveDelay
   -> Maybe InferFunctionPermissions
   -> MaintenanceMode ()
   -> Maybe OptionalInterval
   -> Maybe (HashSet ExperimentalFeature)
   -> Maybe NonNegativeInt
   -> Maybe (NonNegative Seconds)
   -> Maybe WSConnectionInitTimeout
   -> MetadataQueryLoggingMode
   -> Maybe NamingCase
   -> Maybe ExtensionsSchema
   -> ServeOptionsRaw impl)
-> Parser Bool
-> Parser
     (Maybe KeepAliveDelay
      -> Maybe InferFunctionPermissions
      -> MaintenanceMode ()
      -> Maybe OptionalInterval
      -> Maybe (HashSet ExperimentalFeature)
      -> Maybe NonNegativeInt
      -> Maybe (NonNegative Seconds)
      -> Maybe WSConnectionInitTimeout
      -> MetadataQueryLoggingMode
      -> Maybe NamingCase
      -> Maybe ExtensionsSchema
      -> ServeOptionsRaw impl)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser Bool
parseWebSocketCompression
    Parser
  (Maybe KeepAliveDelay
   -> Maybe InferFunctionPermissions
   -> MaintenanceMode ()
   -> Maybe OptionalInterval
   -> Maybe (HashSet ExperimentalFeature)
   -> Maybe NonNegativeInt
   -> Maybe (NonNegative Seconds)
   -> Maybe WSConnectionInitTimeout
   -> MetadataQueryLoggingMode
   -> Maybe NamingCase
   -> Maybe ExtensionsSchema
   -> ServeOptionsRaw impl)
-> Parser (Maybe KeepAliveDelay)
-> Parser
     (Maybe InferFunctionPermissions
      -> MaintenanceMode ()
      -> Maybe OptionalInterval
      -> Maybe (HashSet ExperimentalFeature)
      -> Maybe NonNegativeInt
      -> Maybe (NonNegative Seconds)
      -> Maybe WSConnectionInitTimeout
      -> MetadataQueryLoggingMode
      -> Maybe NamingCase
      -> Maybe ExtensionsSchema
      -> ServeOptionsRaw impl)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (Maybe KeepAliveDelay)
parseWebSocketKeepAlive
    Parser
  (Maybe InferFunctionPermissions
   -> MaintenanceMode ()
   -> Maybe OptionalInterval
   -> Maybe (HashSet ExperimentalFeature)
   -> Maybe NonNegativeInt
   -> Maybe (NonNegative Seconds)
   -> Maybe WSConnectionInitTimeout
   -> MetadataQueryLoggingMode
   -> Maybe NamingCase
   -> Maybe ExtensionsSchema
   -> ServeOptionsRaw impl)
-> Parser (Maybe InferFunctionPermissions)
-> Parser
     (MaintenanceMode ()
      -> Maybe OptionalInterval
      -> Maybe (HashSet ExperimentalFeature)
      -> Maybe NonNegativeInt
      -> Maybe (NonNegative Seconds)
      -> Maybe WSConnectionInitTimeout
      -> MetadataQueryLoggingMode
      -> Maybe NamingCase
      -> Maybe ExtensionsSchema
      -> ServeOptionsRaw impl)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (Maybe InferFunctionPermissions)
parseInferFunctionPerms
    Parser
  (MaintenanceMode ()
   -> Maybe OptionalInterval
   -> Maybe (HashSet ExperimentalFeature)
   -> Maybe NonNegativeInt
   -> Maybe (NonNegative Seconds)
   -> Maybe WSConnectionInitTimeout
   -> MetadataQueryLoggingMode
   -> Maybe NamingCase
   -> Maybe ExtensionsSchema
   -> ServeOptionsRaw impl)
-> Parser (MaintenanceMode ())
-> Parser
     (Maybe OptionalInterval
      -> Maybe (HashSet ExperimentalFeature)
      -> Maybe NonNegativeInt
      -> Maybe (NonNegative Seconds)
      -> Maybe WSConnectionInitTimeout
      -> MetadataQueryLoggingMode
      -> Maybe NamingCase
      -> Maybe ExtensionsSchema
      -> ServeOptionsRaw impl)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (MaintenanceMode ())
parseEnableMaintenanceMode
    Parser
  (Maybe OptionalInterval
   -> Maybe (HashSet ExperimentalFeature)
   -> Maybe NonNegativeInt
   -> Maybe (NonNegative Seconds)
   -> Maybe WSConnectionInitTimeout
   -> MetadataQueryLoggingMode
   -> Maybe NamingCase
   -> Maybe ExtensionsSchema
   -> ServeOptionsRaw impl)
-> Parser (Maybe OptionalInterval)
-> Parser
     (Maybe (HashSet ExperimentalFeature)
      -> Maybe NonNegativeInt
      -> Maybe (NonNegative Seconds)
      -> Maybe WSConnectionInitTimeout
      -> MetadataQueryLoggingMode
      -> Maybe NamingCase
      -> Maybe ExtensionsSchema
      -> ServeOptionsRaw impl)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (Maybe OptionalInterval)
parseSchemaPollInterval
    Parser
  (Maybe (HashSet ExperimentalFeature)
   -> Maybe NonNegativeInt
   -> Maybe (NonNegative Seconds)
   -> Maybe WSConnectionInitTimeout
   -> MetadataQueryLoggingMode
   -> Maybe NamingCase
   -> Maybe ExtensionsSchema
   -> ServeOptionsRaw impl)
-> Parser (Maybe (HashSet ExperimentalFeature))
-> Parser
     (Maybe NonNegativeInt
      -> Maybe (NonNegative Seconds)
      -> Maybe WSConnectionInitTimeout
      -> MetadataQueryLoggingMode
      -> Maybe NamingCase
      -> Maybe ExtensionsSchema
      -> ServeOptionsRaw impl)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (Maybe (HashSet ExperimentalFeature))
parseExperimentalFeatures
    Parser
  (Maybe NonNegativeInt
   -> Maybe (NonNegative Seconds)
   -> Maybe WSConnectionInitTimeout
   -> MetadataQueryLoggingMode
   -> Maybe NamingCase
   -> Maybe ExtensionsSchema
   -> ServeOptionsRaw impl)
-> Parser (Maybe NonNegativeInt)
-> Parser
     (Maybe (NonNegative Seconds)
      -> Maybe WSConnectionInitTimeout
      -> MetadataQueryLoggingMode
      -> Maybe NamingCase
      -> Maybe ExtensionsSchema
      -> ServeOptionsRaw impl)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (Maybe NonNegativeInt)
parseEventsFetchBatchSize
    Parser
  (Maybe (NonNegative Seconds)
   -> Maybe WSConnectionInitTimeout
   -> MetadataQueryLoggingMode
   -> Maybe NamingCase
   -> Maybe ExtensionsSchema
   -> ServeOptionsRaw impl)
-> Parser (Maybe (NonNegative Seconds))
-> Parser
     (Maybe WSConnectionInitTimeout
      -> MetadataQueryLoggingMode
      -> Maybe NamingCase
      -> Maybe ExtensionsSchema
      -> ServeOptionsRaw impl)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (Maybe (NonNegative Seconds))
parseGracefulShutdownTimeout
    Parser
  (Maybe WSConnectionInitTimeout
   -> MetadataQueryLoggingMode
   -> Maybe NamingCase
   -> Maybe ExtensionsSchema
   -> ServeOptionsRaw impl)
-> Parser (Maybe WSConnectionInitTimeout)
-> Parser
     (MetadataQueryLoggingMode
      -> Maybe NamingCase
      -> Maybe ExtensionsSchema
      -> ServeOptionsRaw impl)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (Maybe WSConnectionInitTimeout)
parseWebSocketConnectionInitTimeout
    Parser
  (MetadataQueryLoggingMode
   -> Maybe NamingCase
   -> Maybe ExtensionsSchema
   -> ServeOptionsRaw impl)
-> Parser MetadataQueryLoggingMode
-> Parser
     (Maybe NamingCase
      -> Maybe ExtensionsSchema -> ServeOptionsRaw impl)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser MetadataQueryLoggingMode
parseEnableMetadataQueryLogging
    Parser
  (Maybe NamingCase
   -> Maybe ExtensionsSchema -> ServeOptionsRaw impl)
-> Parser (Maybe NamingCase)
-> Parser (Maybe ExtensionsSchema -> ServeOptionsRaw impl)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (Maybe NamingCase)
parseDefaultNamingConvention
    Parser (Maybe ExtensionsSchema -> ServeOptionsRaw impl)
-> Parser (Maybe ExtensionsSchema) -> Parser (ServeOptionsRaw impl)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (Maybe ExtensionsSchema)
parseExtensionsSchema

--------------------------------------------------------------------------------
-- Serve Options

parseServerPort :: Opt.Parser (Maybe Config.Port)
parseServerPort :: Parser (Maybe Port)
parseServerPort =
  Parser Port -> Parser (Maybe Port)
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
Opt.optional (Parser Port -> Parser (Maybe Port))
-> Parser Port -> Parser (Maybe Port)
forall a b. (a -> b) -> a -> b
$
    ReadM Port -> Mod OptionFields Port -> Parser Port
forall a. ReadM a -> Mod OptionFields a -> Parser a
Opt.option
      ((String -> Either String Port) -> ReadM Port
forall a. (String -> Either String a) -> ReadM a
Opt.eitherReader String -> Either String Port
forall a. FromEnv a => String -> Either String a
Env.fromEnv)
      ( String -> Mod OptionFields Port
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"server-port"
          Mod OptionFields Port
-> Mod OptionFields Port -> Mod OptionFields Port
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields Port
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
Opt.metavar String
"<PORT>"
          Mod OptionFields Port
-> Mod OptionFields Port -> Mod OptionFields Port
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields Port
forall (f :: * -> *) a. String -> Mod f a
Opt.help (Option Port -> String
forall def. Option def -> String
Config._helpMessage Option Port
servePortOption)
      )

servePortOption :: Config.Option Config.Port
servePortOption :: Option Port
servePortOption =
  Option :: forall def. def -> String -> String -> Option def
Config.Option
    { _default :: Port
_default = Int -> Port
Config.unsafePort Int
8080,
      _envVar :: String
_envVar = String
"HASURA_GRAPHQL_SERVER_PORT",
      _helpMessage :: String
_helpMessage = String
"Port on which graphql-engine should be served (default: 8080)"
    }

parseServerHost :: Opt.Parser (Maybe Warp.HostPreference)
parseServerHost :: Parser (Maybe HostPreference)
parseServerHost =
  Parser HostPreference -> Parser (Maybe HostPreference)
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
Opt.optional (Parser HostPreference -> Parser (Maybe HostPreference))
-> Parser HostPreference -> Parser (Maybe HostPreference)
forall a b. (a -> b) -> a -> b
$
    Mod OptionFields HostPreference -> Parser HostPreference
forall s. IsString s => Mod OptionFields s -> Parser s
Opt.strOption
      ( String -> Mod OptionFields HostPreference
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"server-host"
          Mod OptionFields HostPreference
-> Mod OptionFields HostPreference
-> Mod OptionFields HostPreference
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields HostPreference
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
Opt.metavar String
"<HOST>"
          Mod OptionFields HostPreference
-> Mod OptionFields HostPreference
-> Mod OptionFields HostPreference
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields HostPreference
forall (f :: * -> *) a. String -> Mod f a
Opt.help (Option HostPreference -> String
forall def. Option def -> String
Config._helpMessage Option HostPreference
serveHostOption)
      )

serveHostOption :: Config.Option Warp.HostPreference
serveHostOption :: Option HostPreference
serveHostOption =
  Option :: forall def. def -> String -> String -> Option def
Config.Option
    { _default :: HostPreference
_default = HostPreference
"*",
      _envVar :: String
_envVar = String
"HASURA_GRAPHQL_SERVER_HOST",
      _helpMessage :: String
_helpMessage = String
"Host on which graphql-engine will listen (default: *)"
    }

parseConnParams :: Opt.Parser Config.ConnParamsRaw
parseConnParams :: Parser ConnParamsRaw
parseConnParams =
  Maybe NonNegativeInt
-> Maybe NonNegativeInt
-> Maybe NonNegativeInt
-> Maybe (NonNegative NominalDiffTime)
-> Maybe Bool
-> Maybe (NonNegative NominalDiffTime)
-> ConnParamsRaw
Config.ConnParamsRaw (Maybe NonNegativeInt
 -> Maybe NonNegativeInt
 -> Maybe NonNegativeInt
 -> Maybe (NonNegative NominalDiffTime)
 -> Maybe Bool
 -> Maybe (NonNegative NominalDiffTime)
 -> ConnParamsRaw)
-> Parser (Maybe NonNegativeInt)
-> Parser
     (Maybe NonNegativeInt
      -> Maybe NonNegativeInt
      -> Maybe (NonNegative NominalDiffTime)
      -> Maybe Bool
      -> Maybe (NonNegative NominalDiffTime)
      -> ConnParamsRaw)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser (Maybe NonNegativeInt)
pgStripes Parser
  (Maybe NonNegativeInt
   -> Maybe NonNegativeInt
   -> Maybe (NonNegative NominalDiffTime)
   -> Maybe Bool
   -> Maybe (NonNegative NominalDiffTime)
   -> ConnParamsRaw)
-> Parser (Maybe NonNegativeInt)
-> Parser
     (Maybe NonNegativeInt
      -> Maybe (NonNegative NominalDiffTime)
      -> Maybe Bool
      -> Maybe (NonNegative NominalDiffTime)
      -> ConnParamsRaw)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (Maybe NonNegativeInt)
pgConns Parser
  (Maybe NonNegativeInt
   -> Maybe (NonNegative NominalDiffTime)
   -> Maybe Bool
   -> Maybe (NonNegative NominalDiffTime)
   -> ConnParamsRaw)
-> Parser (Maybe NonNegativeInt)
-> Parser
     (Maybe (NonNegative NominalDiffTime)
      -> Maybe Bool
      -> Maybe (NonNegative NominalDiffTime)
      -> ConnParamsRaw)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (Maybe NonNegativeInt)
pgIdleTimeout Parser
  (Maybe (NonNegative NominalDiffTime)
   -> Maybe Bool
   -> Maybe (NonNegative NominalDiffTime)
   -> ConnParamsRaw)
-> Parser (Maybe (NonNegative NominalDiffTime))
-> Parser
     (Maybe Bool
      -> Maybe (NonNegative NominalDiffTime) -> ConnParamsRaw)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (Maybe (NonNegative NominalDiffTime))
pgConnLifetime Parser
  (Maybe Bool
   -> Maybe (NonNegative NominalDiffTime) -> ConnParamsRaw)
-> Parser (Maybe Bool)
-> Parser (Maybe (NonNegative NominalDiffTime) -> ConnParamsRaw)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (Maybe Bool)
pgUsePreparedStatements Parser (Maybe (NonNegative NominalDiffTime) -> ConnParamsRaw)
-> Parser (Maybe (NonNegative NominalDiffTime))
-> Parser ConnParamsRaw
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (Maybe (NonNegative NominalDiffTime))
pgPoolTimeout
  where
    pgStripes :: Opt.Parser (Maybe Numeric.NonNegativeInt)
    pgStripes :: Parser (Maybe NonNegativeInt)
pgStripes =
      Parser NonNegativeInt -> Parser (Maybe NonNegativeInt)
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
Opt.optional (Parser NonNegativeInt -> Parser (Maybe NonNegativeInt))
-> Parser NonNegativeInt -> Parser (Maybe NonNegativeInt)
forall a b. (a -> b) -> a -> b
$
        ReadM NonNegativeInt
-> Mod OptionFields NonNegativeInt -> Parser NonNegativeInt
forall a. ReadM a -> Mod OptionFields a -> Parser a
Opt.option
          ((String -> Either String NonNegativeInt) -> ReadM NonNegativeInt
forall a. (String -> Either String a) -> ReadM a
Opt.eitherReader String -> Either String NonNegativeInt
forall a. FromEnv a => String -> Either String a
Env.fromEnv)
          ( String -> Mod OptionFields NonNegativeInt
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"stripes"
              Mod OptionFields NonNegativeInt
-> Mod OptionFields NonNegativeInt
-> Mod OptionFields NonNegativeInt
forall a. Semigroup a => a -> a -> a
<> Char -> Mod OptionFields NonNegativeInt
forall (f :: * -> *) a. HasName f => Char -> Mod f a
Opt.short Char
's'
              Mod OptionFields NonNegativeInt
-> Mod OptionFields NonNegativeInt
-> Mod OptionFields NonNegativeInt
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields NonNegativeInt
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
Opt.metavar String
"<NO OF STRIPES>"
              Mod OptionFields NonNegativeInt
-> Mod OptionFields NonNegativeInt
-> Mod OptionFields NonNegativeInt
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields NonNegativeInt
forall (f :: * -> *) a. String -> Mod f a
Opt.help (Option NonNegativeInt -> String
forall def. Option def -> String
Config._helpMessage Option NonNegativeInt
pgStripesOption)
          )

    pgConns :: Opt.Parser (Maybe Numeric.NonNegativeInt)
    pgConns :: Parser (Maybe NonNegativeInt)
pgConns =
      Parser NonNegativeInt -> Parser (Maybe NonNegativeInt)
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
Opt.optional (Parser NonNegativeInt -> Parser (Maybe NonNegativeInt))
-> Parser NonNegativeInt -> Parser (Maybe NonNegativeInt)
forall a b. (a -> b) -> a -> b
$
        ReadM NonNegativeInt
-> Mod OptionFields NonNegativeInt -> Parser NonNegativeInt
forall a. ReadM a -> Mod OptionFields a -> Parser a
Opt.option
          ((String -> Either String NonNegativeInt) -> ReadM NonNegativeInt
forall a. (String -> Either String a) -> ReadM a
Opt.eitherReader String -> Either String NonNegativeInt
forall a. FromEnv a => String -> Either String a
Env.fromEnv)
          ( String -> Mod OptionFields NonNegativeInt
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"connections"
              Mod OptionFields NonNegativeInt
-> Mod OptionFields NonNegativeInt
-> Mod OptionFields NonNegativeInt
forall a. Semigroup a => a -> a -> a
<> Char -> Mod OptionFields NonNegativeInt
forall (f :: * -> *) a. HasName f => Char -> Mod f a
Opt.short Char
'c'
              Mod OptionFields NonNegativeInt
-> Mod OptionFields NonNegativeInt
-> Mod OptionFields NonNegativeInt
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields NonNegativeInt
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
Opt.metavar String
"<NO OF CONNS>"
              Mod OptionFields NonNegativeInt
-> Mod OptionFields NonNegativeInt
-> Mod OptionFields NonNegativeInt
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields NonNegativeInt
forall (f :: * -> *) a. String -> Mod f a
Opt.help (Option NonNegativeInt -> String
forall def. Option def -> String
Config._helpMessage Option NonNegativeInt
pgConnsOption)
          )

    pgIdleTimeout :: Opt.Parser (Maybe Numeric.NonNegativeInt)
    pgIdleTimeout :: Parser (Maybe NonNegativeInt)
pgIdleTimeout =
      Parser NonNegativeInt -> Parser (Maybe NonNegativeInt)
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
Opt.optional (Parser NonNegativeInt -> Parser (Maybe NonNegativeInt))
-> Parser NonNegativeInt -> Parser (Maybe NonNegativeInt)
forall a b. (a -> b) -> a -> b
$
        ReadM NonNegativeInt
-> Mod OptionFields NonNegativeInt -> Parser NonNegativeInt
forall a. ReadM a -> Mod OptionFields a -> Parser a
Opt.option
          ((String -> Either String NonNegativeInt) -> ReadM NonNegativeInt
forall a. (String -> Either String a) -> ReadM a
Opt.eitherReader String -> Either String NonNegativeInt
forall a. FromEnv a => String -> Either String a
Env.fromEnv)
          ( String -> Mod OptionFields NonNegativeInt
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"timeout"
              Mod OptionFields NonNegativeInt
-> Mod OptionFields NonNegativeInt
-> Mod OptionFields NonNegativeInt
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields NonNegativeInt
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
Opt.metavar String
"<SECONDS>"
              Mod OptionFields NonNegativeInt
-> Mod OptionFields NonNegativeInt
-> Mod OptionFields NonNegativeInt
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields NonNegativeInt
forall (f :: * -> *) a. String -> Mod f a
Opt.help (Option NonNegativeInt -> String
forall def. Option def -> String
Config._helpMessage Option NonNegativeInt
pgTimeoutOption)
          )

    pgConnLifetime :: Opt.Parser (Maybe (Numeric.NonNegative Time.NominalDiffTime))
    pgConnLifetime :: Parser (Maybe (NonNegative NominalDiffTime))
pgConnLifetime =
      Parser (NonNegative NominalDiffTime)
-> Parser (Maybe (NonNegative NominalDiffTime))
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
Opt.optional (Parser (NonNegative NominalDiffTime)
 -> Parser (Maybe (NonNegative NominalDiffTime)))
-> Parser (NonNegative NominalDiffTime)
-> Parser (Maybe (NonNegative NominalDiffTime))
forall a b. (a -> b) -> a -> b
$
        ReadM (NonNegative NominalDiffTime)
-> Mod OptionFields (NonNegative NominalDiffTime)
-> Parser (NonNegative NominalDiffTime)
forall a. ReadM a -> Mod OptionFields a -> Parser a
Opt.option
          ((String -> Either String (NonNegative NominalDiffTime))
-> ReadM (NonNegative NominalDiffTime)
forall a. (String -> Either String a) -> ReadM a
Opt.eitherReader String -> Either String (NonNegative NominalDiffTime)
forall a. FromEnv a => String -> Either String a
Env.fromEnv)
          ( String -> Mod OptionFields (NonNegative NominalDiffTime)
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"conn-lifetime"
              Mod OptionFields (NonNegative NominalDiffTime)
-> Mod OptionFields (NonNegative NominalDiffTime)
-> Mod OptionFields (NonNegative NominalDiffTime)
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields (NonNegative NominalDiffTime)
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
Opt.metavar String
"<SECONDS>"
              Mod OptionFields (NonNegative NominalDiffTime)
-> Mod OptionFields (NonNegative NominalDiffTime)
-> Mod OptionFields (NonNegative NominalDiffTime)
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields (NonNegative NominalDiffTime)
forall (f :: * -> *) a. String -> Mod f a
Opt.help (Option (NonNegative NominalDiffTime) -> String
forall def. Option def -> String
Config._helpMessage Option (NonNegative NominalDiffTime)
pgConnLifetimeOption)
          )

    pgUsePreparedStatements :: Opt.Parser (Maybe Bool)
    pgUsePreparedStatements :: Parser (Maybe Bool)
pgUsePreparedStatements =
      Parser Bool -> Parser (Maybe Bool)
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
Opt.optional (Parser Bool -> Parser (Maybe Bool))
-> Parser Bool -> Parser (Maybe Bool)
forall a b. (a -> b) -> a -> b
$
        ReadM Bool -> Mod OptionFields Bool -> Parser Bool
forall a. ReadM a -> Mod OptionFields a -> Parser a
Opt.option
          ((String -> Either String Bool) -> ReadM Bool
forall a. (String -> Either String a) -> ReadM a
Opt.eitherReader String -> Either String Bool
forall a. FromEnv a => String -> Either String a
Env.fromEnv)
          ( String -> Mod OptionFields Bool
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"use-prepared-statements"
              Mod OptionFields Bool
-> Mod OptionFields Bool -> Mod OptionFields Bool
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields Bool
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
Opt.metavar String
"<true|false>"
              Mod OptionFields Bool
-> Mod OptionFields Bool -> Mod OptionFields Bool
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields Bool
forall (f :: * -> *) a. String -> Mod f a
Opt.help (Option Bool -> String
forall def. Option def -> String
Config._helpMessage Option Bool
pgUsePreparedStatementsOption)
          )

    pgPoolTimeout :: Opt.Parser (Maybe (Numeric.NonNegative Time.NominalDiffTime))
    pgPoolTimeout :: Parser (Maybe (NonNegative NominalDiffTime))
pgPoolTimeout =
      Parser (NonNegative NominalDiffTime)
-> Parser (Maybe (NonNegative NominalDiffTime))
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
Opt.optional (Parser (NonNegative NominalDiffTime)
 -> Parser (Maybe (NonNegative NominalDiffTime)))
-> Parser (NonNegative NominalDiffTime)
-> Parser (Maybe (NonNegative NominalDiffTime))
forall a b. (a -> b) -> a -> b
$
        ReadM (NonNegative NominalDiffTime)
-> Mod OptionFields (NonNegative NominalDiffTime)
-> Parser (NonNegative NominalDiffTime)
forall a. ReadM a -> Mod OptionFields a -> Parser a
Opt.option
          ((String -> Either String (NonNegative NominalDiffTime))
-> ReadM (NonNegative NominalDiffTime)
forall a. (String -> Either String a) -> ReadM a
Opt.eitherReader String -> Either String (NonNegative NominalDiffTime)
forall a. FromEnv a => String -> Either String a
Env.fromEnv)
          ( String -> Mod OptionFields (NonNegative NominalDiffTime)
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"pool-timeout"
              Mod OptionFields (NonNegative NominalDiffTime)
-> Mod OptionFields (NonNegative NominalDiffTime)
-> Mod OptionFields (NonNegative NominalDiffTime)
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields (NonNegative NominalDiffTime)
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
Opt.metavar String
"<SECONDS>"
              Mod OptionFields (NonNegative NominalDiffTime)
-> Mod OptionFields (NonNegative NominalDiffTime)
-> Mod OptionFields (NonNegative NominalDiffTime)
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields (NonNegative NominalDiffTime)
forall (f :: * -> *) a. String -> Mod f a
Opt.help (Option () -> String
forall def. Option def -> String
Config._helpMessage Option ()
pgPoolTimeoutOption)
          )

pgStripesOption :: Config.Option Numeric.NonNegativeInt
pgStripesOption :: Option NonNegativeInt
pgStripesOption =
  Option :: forall def. def -> String -> String -> Option def
Config.Option
    { _default :: NonNegativeInt
_default = Int -> NonNegativeInt
Numeric.unsafeNonNegativeInt Int
1,
      _envVar :: String
_envVar = String
"HASURA_GRAPHQL_PG_STRIPES",
      _helpMessage :: String
_helpMessage =
        String
"Number of stripes (distinct sub-pools) to maintain with Postgres (default: 1). "
          String -> String -> String
forall a. Semigroup a => a -> a -> a
<> String
"New connections will be taken from a particular stripe pseudo-randomly."
    }

pgConnsOption :: Config.Option Numeric.NonNegativeInt
pgConnsOption :: Option NonNegativeInt
pgConnsOption =
  Option :: forall def. def -> String -> String -> Option def
Config.Option
    { _default :: NonNegativeInt
_default = Int -> NonNegativeInt
Numeric.unsafeNonNegativeInt Int
50,
      _envVar :: String
_envVar = String
"HASURA_GRAPHQL_PG_CONNECTIONS",
      _helpMessage :: String
_helpMessage =
        String
"Maximum number of Postgres connections that can be opened per stripe (default: 50). "
          String -> String -> String
forall a. Semigroup a => a -> a -> a
<> String
"When the maximum is reached we will block until a new connection becomes available, "
          String -> String -> String
forall a. Semigroup a => a -> a -> a
<> String
"even if there is capacity in other stripes."
    }

pgTimeoutOption :: Config.Option Numeric.NonNegativeInt
pgTimeoutOption :: Option NonNegativeInt
pgTimeoutOption =
  Option :: forall def. def -> String -> String -> Option def
Config.Option
    { _default :: NonNegativeInt
_default = Int -> NonNegativeInt
Numeric.unsafeNonNegativeInt Int
180,
      _envVar :: String
_envVar = String
"HASURA_GRAPHQL_PG_TIMEOUT",
      _helpMessage :: String
_helpMessage = String
"Each connection's idle time before it is closed (default: 180 sec)"
    }

pgConnLifetimeOption :: Config.Option (Numeric.NonNegative Time.NominalDiffTime)
pgConnLifetimeOption :: Option (NonNegative NominalDiffTime)
pgConnLifetimeOption =
  Option :: forall def. def -> String -> String -> Option def
Config.Option
    { _default :: NonNegative NominalDiffTime
_default = NominalDiffTime -> NonNegative NominalDiffTime
forall a. a -> NonNegative a
Numeric.unsafeNonNegative NominalDiffTime
600,
      _envVar :: String
_envVar = String
"HASURA_GRAPHQL_PG_CONN_LIFETIME",
      _helpMessage :: String
_helpMessage =
        String
"Time from connection creation after which the connection should be destroyed and a new one "
          String -> String -> String
forall a. Semigroup a => a -> a -> a
<> String
"created. A value of 0 indicates we should never destroy an active connection. If 0 is "
          String -> String -> String
forall a. Semigroup a => a -> a -> a
<> String
"passed, memory from large query results may not be reclaimed. (default: 600 sec)"
    }

pgUsePreparedStatementsOption :: Config.Option Bool
pgUsePreparedStatementsOption :: Option Bool
pgUsePreparedStatementsOption =
  Option :: forall def. def -> String -> String -> Option def
Config.Option
    { _default :: Bool
_default = Bool
True,
      _envVar :: String
_envVar = String
"HASURA_GRAPHQL_USE_PREPARED_STATEMENTS",
      _helpMessage :: String
_helpMessage = String
"Use prepared statements for queries (default: true)"
    }

pgPoolTimeoutOption :: Config.Option ()
pgPoolTimeoutOption :: Option ()
pgPoolTimeoutOption =
  Option :: forall def. def -> String -> String -> Option def
Config.Option
    { _default :: ()
_default = (),
      _envVar :: String
_envVar = String
"HASURA_GRAPHQL_PG_POOL_TIMEOUT",
      _helpMessage :: String
_helpMessage = String
"How long to wait when acquiring a Postgres connection, in seconds (default: forever)."
    }

parseTxIsolation :: Opt.Parser (Maybe Query.TxIsolation)
parseTxIsolation :: Parser (Maybe TxIsolation)
parseTxIsolation =
  Parser TxIsolation -> Parser (Maybe TxIsolation)
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
Opt.optional (Parser TxIsolation -> Parser (Maybe TxIsolation))
-> Parser TxIsolation -> Parser (Maybe TxIsolation)
forall a b. (a -> b) -> a -> b
$
    ReadM TxIsolation
-> Mod OptionFields TxIsolation -> Parser TxIsolation
forall a. ReadM a -> Mod OptionFields a -> Parser a
Opt.option
      ((String -> Either String TxIsolation) -> ReadM TxIsolation
forall a. (String -> Either String a) -> ReadM a
Opt.eitherReader String -> Either String TxIsolation
forall a. FromEnv a => String -> Either String a
Env.fromEnv)
      ( String -> Mod OptionFields TxIsolation
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"tx-iso"
          Mod OptionFields TxIsolation
-> Mod OptionFields TxIsolation -> Mod OptionFields TxIsolation
forall a. Semigroup a => a -> a -> a
<> Char -> Mod OptionFields TxIsolation
forall (f :: * -> *) a. HasName f => Char -> Mod f a
Opt.short Char
'i'
          Mod OptionFields TxIsolation
-> Mod OptionFields TxIsolation -> Mod OptionFields TxIsolation
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields TxIsolation
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
Opt.metavar String
"<TXISO>"
          Mod OptionFields TxIsolation
-> Mod OptionFields TxIsolation -> Mod OptionFields TxIsolation
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields TxIsolation
forall (f :: * -> *) a. String -> Mod f a
Opt.help (Option TxIsolation -> String
forall def. Option def -> String
Config._helpMessage Option TxIsolation
txIsolationOption)
      )

txIsolationOption :: Config.Option Query.TxIsolation
txIsolationOption :: Option TxIsolation
txIsolationOption =
  Option :: forall def. def -> String -> String -> Option def
Config.Option
    { _default :: TxIsolation
Config._default = TxIsolation
Query.ReadCommitted,
      _envVar :: String
Config._envVar = String
"HASURA_GRAPHQL_TX_ISOLATION",
      _helpMessage :: String
Config._helpMessage = String
"transaction isolation. read-committed / repeatable-read / serializable (default: read-commited)"
    }

parseAdminSecret :: Opt.Parser (Maybe Auth.AdminSecretHash)
parseAdminSecret :: Parser (Maybe AdminSecretHash)
parseAdminSecret =
  Parser AdminSecretHash -> Parser (Maybe AdminSecretHash)
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
Opt.optional (Parser AdminSecretHash -> Parser (Maybe AdminSecretHash))
-> Parser AdminSecretHash -> Parser (Maybe AdminSecretHash)
forall a b. (a -> b) -> a -> b
$
    Text -> AdminSecretHash
Auth.hashAdminSecret
      (Text -> AdminSecretHash) -> Parser Text -> Parser AdminSecretHash
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Mod OptionFields Text -> Parser Text
forall s. IsString s => Mod OptionFields s -> Parser s
Opt.strOption
        ( String -> Mod OptionFields Text
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"admin-secret"
            Mod OptionFields Text
-> Mod OptionFields Text -> Mod OptionFields Text
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields Text
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
Opt.metavar String
"ADMIN SECRET KEY"
            Mod OptionFields Text
-> Mod OptionFields Text -> Mod OptionFields Text
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields Text
forall (f :: * -> *) a. String -> Mod f a
Opt.help (Option () -> String
forall def. Option def -> String
Config._helpMessage Option ()
adminSecretOption)
        )

adminSecretOption :: Config.Option ()
adminSecretOption :: Option ()
adminSecretOption =
  Option :: forall def. def -> String -> String -> Option def
Config.Option
    { _default :: ()
Config._default = (),
      _envVar :: String
Config._envVar = String
"HASURA_GRAPHQL_ADMIN_SECRET",
      _helpMessage :: String
Config._helpMessage = String
"Admin Secret key, required to access this instance"
    }

parseAccessKey :: Opt.Parser (Maybe Auth.AdminSecretHash)
parseAccessKey :: Parser (Maybe AdminSecretHash)
parseAccessKey =
  Parser AdminSecretHash -> Parser (Maybe AdminSecretHash)
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
Opt.optional (Parser AdminSecretHash -> Parser (Maybe AdminSecretHash))
-> Parser AdminSecretHash -> Parser (Maybe AdminSecretHash)
forall a b. (a -> b) -> a -> b
$
    Text -> AdminSecretHash
Auth.hashAdminSecret
      (Text -> AdminSecretHash) -> Parser Text -> Parser AdminSecretHash
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Mod OptionFields Text -> Parser Text
forall s. IsString s => Mod OptionFields s -> Parser s
Opt.strOption
        ( String -> Mod OptionFields Text
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"access-key"
            Mod OptionFields Text
-> Mod OptionFields Text -> Mod OptionFields Text
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields Text
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
Opt.metavar String
"ADMIN SECRET KEY (DEPRECATED: USE --admin-secret)"
            Mod OptionFields Text
-> Mod OptionFields Text -> Mod OptionFields Text
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields Text
forall (f :: * -> *) a. String -> Mod f a
Opt.help (Option () -> String
forall def. Option def -> String
Config._helpMessage Option ()
accessKeyOption)
        )

accessKeyOption :: Config.Option ()
accessKeyOption :: Option ()
accessKeyOption =
  Option :: forall def. def -> String -> String -> Option def
Config.Option
    { _default :: ()
Config._default = (),
      _envVar :: String
Config._envVar = String
"HASURA_GRAPHQL_ACCESS_KEY",
      _helpMessage :: String
Config._helpMessage = String
"Admin secret key, required to access this instance (deprecated: use HASURA_GRAPHQL_ADMIN_SECRET instead)"
    }

parseAuthHook :: Opt.Parser Config.AuthHookRaw
parseAuthHook :: Parser AuthHookRaw
parseAuthHook =
  Maybe Text -> Maybe AuthHookType -> AuthHookRaw
Config.AuthHookRaw (Maybe Text -> Maybe AuthHookType -> AuthHookRaw)
-> Parser (Maybe Text)
-> Parser (Maybe AuthHookType -> AuthHookRaw)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser (Maybe Text)
url Parser (Maybe AuthHookType -> AuthHookRaw)
-> Parser (Maybe AuthHookType) -> Parser AuthHookRaw
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (Maybe AuthHookType)
urlType
  where
    url :: Parser (Maybe Text)
url =
      Parser Text -> Parser (Maybe Text)
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
Opt.optional (Parser Text -> Parser (Maybe Text))
-> Parser Text -> Parser (Maybe Text)
forall a b. (a -> b) -> a -> b
$
        Mod OptionFields Text -> Parser Text
forall s. IsString s => Mod OptionFields s -> Parser s
Opt.strOption
          ( String -> Mod OptionFields Text
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"auth-hook"
              Mod OptionFields Text
-> Mod OptionFields Text -> Mod OptionFields Text
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields Text
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
Opt.metavar String
"<WEB HOOK URL>"
              Mod OptionFields Text
-> Mod OptionFields Text -> Mod OptionFields Text
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields Text
forall (f :: * -> *) a. String -> Mod f a
Opt.help (Option () -> String
forall def. Option def -> String
Config._helpMessage Option ()
authHookOption)
          )
    urlType :: Parser (Maybe AuthHookType)
urlType =
      Parser AuthHookType -> Parser (Maybe AuthHookType)
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
Opt.optional (Parser AuthHookType -> Parser (Maybe AuthHookType))
-> Parser AuthHookType -> Parser (Maybe AuthHookType)
forall a b. (a -> b) -> a -> b
$
        ReadM AuthHookType
-> Mod OptionFields AuthHookType -> Parser AuthHookType
forall a. ReadM a -> Mod OptionFields a -> Parser a
Opt.option
          ((String -> Either String AuthHookType) -> ReadM AuthHookType
forall a. (String -> Either String a) -> ReadM a
Opt.eitherReader String -> Either String AuthHookType
forall a. FromEnv a => String -> Either String a
Env.fromEnv)
          ( String -> Mod OptionFields AuthHookType
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"auth-hook-mode"
              Mod OptionFields AuthHookType
-> Mod OptionFields AuthHookType -> Mod OptionFields AuthHookType
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields AuthHookType
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
Opt.metavar String
"<GET|POST>"
              Mod OptionFields AuthHookType
-> Mod OptionFields AuthHookType -> Mod OptionFields AuthHookType
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields AuthHookType
forall (f :: * -> *) a. String -> Mod f a
Opt.help (Option AuthHookType -> String
forall def. Option def -> String
Config._helpMessage Option AuthHookType
authHookModeOption)
          )

authHookOption :: Config.Option ()
authHookOption :: Option ()
authHookOption =
  Option :: forall def. def -> String -> String -> Option def
Config.Option
    { _default :: ()
Config._default = (),
      _envVar :: String
Config._envVar = String
"HASURA_GRAPHQL_AUTH_HOOK",
      _helpMessage :: String
Config._helpMessage = String
"URL of the authorization webhook required to authorize requests"
    }

authHookModeOption :: Config.Option Auth.AuthHookType
authHookModeOption :: Option AuthHookType
authHookModeOption =
  Option :: forall def. def -> String -> String -> Option def
Config.Option
    { _default :: AuthHookType
Config._default = AuthHookType
Auth.AHTGet,
      _envVar :: String
Config._envVar = String
"HASURA_GRAPHQL_AUTH_HOOK_MODE",
      _helpMessage :: String
Config._helpMessage = String
"HTTP method to use for authorization webhook (default: GET)"
    }

parseJwtSecret :: Opt.Parser (Maybe Auth.JWTConfig)
parseJwtSecret :: Parser (Maybe JWTConfig)
parseJwtSecret =
  Parser JWTConfig -> Parser (Maybe JWTConfig)
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
Opt.optional (Parser JWTConfig -> Parser (Maybe JWTConfig))
-> Parser JWTConfig -> Parser (Maybe JWTConfig)
forall a b. (a -> b) -> a -> b
$
    ReadM JWTConfig -> Mod OptionFields JWTConfig -> Parser JWTConfig
forall a. ReadM a -> Mod OptionFields a -> Parser a
Opt.option
      ((String -> Either String JWTConfig) -> ReadM JWTConfig
forall a. (String -> Either String a) -> ReadM a
Opt.eitherReader String -> Either String JWTConfig
forall a. FromEnv a => String -> Either String a
Env.fromEnv)
      ( String -> Mod OptionFields JWTConfig
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"jwt-secret"
          Mod OptionFields JWTConfig
-> Mod OptionFields JWTConfig -> Mod OptionFields JWTConfig
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields JWTConfig
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
Opt.metavar String
"<JSON CONFIG>"
          Mod OptionFields JWTConfig
-> Mod OptionFields JWTConfig -> Mod OptionFields JWTConfig
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields JWTConfig
forall (f :: * -> *) a. String -> Mod f a
Opt.help (Option () -> String
forall def. Option def -> String
Config._helpMessage Option ()
jwtSecretOption)
      )

jwtSecretOption :: Config.Option ()
jwtSecretOption :: Option ()
jwtSecretOption =
  Option :: forall def. def -> String -> String -> Option def
Config.Option
    { _default :: ()
Config._default = (),
      _envVar :: String
Config._envVar = String
"HASURA_GRAPHQL_JWT_SECRET",
      _helpMessage :: String
Config._helpMessage =
        String
"The JSON containing type and the JWK used for verifying. e.g: "
          String -> String -> String
forall a. Semigroup a => a -> a -> a
<> String
"`{\"type\": \"HS256\", \"key\": \"<your-hmac-shared-secret>\", \"claims_namespace\": \"<optional-custom-claims-key-name>\"}`,"
          String -> String -> String
forall a. Semigroup a => a -> a -> a
<> String
"`{\"type\": \"RS256\", \"key\": \"<your-PEM-RSA-public-key>\", \"claims_namespace\": \"<optional-custom-claims-key-name>\"}`"
    }

parseUnAuthRole :: Opt.Parser (Maybe Session.RoleName)
parseUnAuthRole :: Parser (Maybe RoleName)
parseUnAuthRole =
  (Maybe Text -> Maybe RoleName)
-> Parser (Maybe Text) -> Parser (Maybe RoleName)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Maybe Text -> Maybe RoleName
mkRoleName (Parser (Maybe Text) -> Parser (Maybe RoleName))
-> Parser (Maybe Text) -> Parser (Maybe RoleName)
forall a b. (a -> b) -> a -> b
$
    Parser Text -> Parser (Maybe Text)
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
Opt.optional (Parser Text -> Parser (Maybe Text))
-> Parser Text -> Parser (Maybe Text)
forall a b. (a -> b) -> a -> b
$
      Mod OptionFields Text -> Parser Text
forall s. IsString s => Mod OptionFields s -> Parser s
Opt.strOption
        ( String -> Mod OptionFields Text
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"unauthorized-role"
            Mod OptionFields Text
-> Mod OptionFields Text -> Mod OptionFields Text
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields Text
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
Opt.metavar String
"<ROLE>"
            Mod OptionFields Text
-> Mod OptionFields Text -> Mod OptionFields Text
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields Text
forall (f :: * -> *) a. String -> Mod f a
Opt.help (Option () -> String
forall def. Option def -> String
Config._helpMessage Option ()
unAuthRoleOption)
        )
  where
    mkRoleName :: Maybe Text -> Maybe RoleName
mkRoleName Maybe Text
mText = Maybe Text
mText Maybe Text -> (Text -> Maybe RoleName) -> Maybe RoleName
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Text -> Maybe RoleName
Session.mkRoleName

unAuthRoleOption :: Config.Option ()
unAuthRoleOption :: Option ()
unAuthRoleOption =
  Option :: forall def. def -> String -> String -> Option def
Config.Option
    { _default :: ()
Config._default = (),
      _envVar :: String
Config._envVar = String
"HASURA_GRAPHQL_UNAUTHORIZED_ROLE",
      _helpMessage :: String
Config._helpMessage =
        String
"Unauthorized role, used when admin-secret is not sent in admin-secret only mode "
          String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"or \"Authorization\" header is absent in JWT mode"
    }

parseCorsConfig :: Opt.Parser (Maybe Cors.CorsConfig)
parseCorsConfig :: Parser (Maybe CorsConfig)
parseCorsConfig = Bool -> Maybe CorsConfig -> Maybe CorsConfig
mapCC (Bool -> Maybe CorsConfig -> Maybe CorsConfig)
-> Parser Bool -> Parser (Maybe CorsConfig -> Maybe CorsConfig)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser Bool
disableCors Parser (Maybe CorsConfig -> Maybe CorsConfig)
-> Parser (Maybe CorsConfig) -> Parser (Maybe CorsConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (Maybe CorsConfig)
corsDomain
  where
    corsDomain :: Parser (Maybe CorsConfig)
corsDomain =
      Parser CorsConfig -> Parser (Maybe CorsConfig)
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
Opt.optional (Parser CorsConfig -> Parser (Maybe CorsConfig))
-> Parser CorsConfig -> Parser (Maybe CorsConfig)
forall a b. (a -> b) -> a -> b
$
        ReadM CorsConfig
-> Mod OptionFields CorsConfig -> Parser CorsConfig
forall a. ReadM a -> Mod OptionFields a -> Parser a
Opt.option
          ((String -> Either String CorsConfig) -> ReadM CorsConfig
forall a. (String -> Either String a) -> ReadM a
Opt.eitherReader String -> Either String CorsConfig
forall a. FromEnv a => String -> Either String a
Env.fromEnv)
          ( String -> Mod OptionFields CorsConfig
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"cors-domain"
              Mod OptionFields CorsConfig
-> Mod OptionFields CorsConfig -> Mod OptionFields CorsConfig
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields CorsConfig
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
Opt.metavar String
"<DOMAINS>"
              Mod OptionFields CorsConfig
-> Mod OptionFields CorsConfig -> Mod OptionFields CorsConfig
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields CorsConfig
forall (f :: * -> *) a. String -> Mod f a
Opt.help (Option CorsConfig -> String
forall def. Option def -> String
Config._helpMessage Option CorsConfig
corsDomainOption)
          )

    disableCors :: Parser Bool
disableCors =
      Mod FlagFields Bool -> Parser Bool
Opt.switch
        ( String -> Mod FlagFields Bool
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"disable-cors"
            Mod FlagFields Bool -> Mod FlagFields Bool -> Mod FlagFields Bool
forall a. Semigroup a => a -> a -> a
<> String -> Mod FlagFields Bool
forall (f :: * -> *) a. String -> Mod f a
Opt.help (Option Bool -> String
forall def. Option def -> String
Config._helpMessage Option Bool
disableCorsOption)
        )

    mapCC :: Bool -> Maybe CorsConfig -> Maybe CorsConfig
mapCC Bool
isDisabled Maybe CorsConfig
domains =
      Maybe CorsConfig -> Maybe CorsConfig -> Bool -> Maybe CorsConfig
forall a. a -> a -> Bool -> a
bool Maybe CorsConfig
domains (CorsConfig -> Maybe CorsConfig
forall a. a -> Maybe a
Just (CorsConfig -> Maybe CorsConfig) -> CorsConfig -> Maybe CorsConfig
forall a b. (a -> b) -> a -> b
$ Bool -> CorsConfig
Cors.CCDisabled Bool
False) Bool
isDisabled

corsDomainOption :: Config.Option Cors.CorsConfig
corsDomainOption :: Option CorsConfig
corsDomainOption =
  Option :: forall def. def -> String -> String -> Option def
Config.Option
    { _default :: CorsConfig
Config._default = CorsConfig
Cors.CCAllowAll,
      _envVar :: String
Config._envVar = String
"HASURA_GRAPHQL_CORS_DOMAIN",
      _helpMessage :: String
Config._helpMessage =
        String
"CSV of list of domains, excluding scheme (http/https) and including  port, "
          String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"to allow CORS for. Wildcard domains are allowed. See docs for details."
    }

disableCorsOption :: Config.Option Bool
disableCorsOption :: Option Bool
disableCorsOption =
  Option :: forall def. def -> String -> String -> Option def
Config.Option
    { _default :: Bool
Config._default = Bool
False,
      _envVar :: String
Config._envVar = String
"HASURA_GRAPHQL_DISABLE_CORS",
      _helpMessage :: String
Config._helpMessage = String
"Disable CORS. Do not send any CORS headers on any request"
    }

parseEnableConsole :: Opt.Parser Bool
parseEnableConsole :: Parser Bool
parseEnableConsole =
  Mod FlagFields Bool -> Parser Bool
Opt.switch
    ( String -> Mod FlagFields Bool
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"enable-console"
        Mod FlagFields Bool -> Mod FlagFields Bool -> Mod FlagFields Bool
forall a. Semigroup a => a -> a -> a
<> String -> Mod FlagFields Bool
forall (f :: * -> *) a. String -> Mod f a
Opt.help (Option Bool -> String
forall def. Option def -> String
Config._helpMessage Option Bool
enableConsoleOption)
    )

enableConsoleOption :: Config.Option Bool
enableConsoleOption :: Option Bool
enableConsoleOption =
  Option :: forall def. def -> String -> String -> Option def
Config.Option
    { _default :: Bool
Config._default = Bool
False,
      _envVar :: String
Config._envVar = String
"HASURA_GRAPHQL_ENABLE_CONSOLE",
      _helpMessage :: String
Config._helpMessage = String
"Enable API Console (default: false)"
    }

parseConsoleAssetsDir :: Opt.Parser (Maybe Text)
parseConsoleAssetsDir :: Parser (Maybe Text)
parseConsoleAssetsDir =
  Parser Text -> Parser (Maybe Text)
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
Opt.optional (Parser Text -> Parser (Maybe Text))
-> Parser Text -> Parser (Maybe Text)
forall a b. (a -> b) -> a -> b
$
    ReadM Text -> Mod OptionFields Text -> Parser Text
forall a. ReadM a -> Mod OptionFields a -> Parser a
Opt.option
      ((String -> Either String Text) -> ReadM Text
forall a. (String -> Either String a) -> ReadM a
Opt.eitherReader String -> Either String Text
forall a. FromEnv a => String -> Either String a
Env.fromEnv)
      ( String -> Mod OptionFields Text
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"console-assets-dir"
          Mod OptionFields Text
-> Mod OptionFields Text -> Mod OptionFields Text
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields Text
forall (f :: * -> *) a. String -> Mod f a
Opt.help (Option () -> String
forall def. Option def -> String
Config._helpMessage Option ()
consoleAssetsDirOption)
      )

consoleAssetsDirOption :: Config.Option ()
consoleAssetsDirOption :: Option ()
consoleAssetsDirOption =
  Option :: forall def. def -> String -> String -> Option def
Config.Option
    { _default :: ()
Config._default = (),
      _envVar :: String
Config._envVar = String
"HASURA_GRAPHQL_CONSOLE_ASSETS_DIR",
      _helpMessage :: String
Config._helpMessage =
        String
"A directory from which static assets required for console is served at"
          String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"'/console/assets' path. Can be set to '/srv/console-assets' on the"
          String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" default docker image to disable loading assets from CDN."
    }

-- NOTE: Should this be an 'Opt.flag'?
parseEnableTelemetry :: Opt.Parser (Maybe Bool)
parseEnableTelemetry :: Parser (Maybe Bool)
parseEnableTelemetry =
  Parser Bool -> Parser (Maybe Bool)
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
Opt.optional (Parser Bool -> Parser (Maybe Bool))
-> Parser Bool -> Parser (Maybe Bool)
forall a b. (a -> b) -> a -> b
$
    ReadM Bool -> Mod OptionFields Bool -> Parser Bool
forall a. ReadM a -> Mod OptionFields a -> Parser a
Opt.option
      ((String -> Either String Bool) -> ReadM Bool
forall a. (String -> Either String a) -> ReadM a
Opt.eitherReader String -> Either String Bool
forall a. FromEnv a => String -> Either String a
Env.fromEnv)
      ( String -> Mod OptionFields Bool
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"enable-telemetry"
          Mod OptionFields Bool
-> Mod OptionFields Bool -> Mod OptionFields Bool
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields Bool
forall (f :: * -> *) a. String -> Mod f a
Opt.help (Option Bool -> String
forall def. Option def -> String
Config._helpMessage Option Bool
enableTelemetryOption)
      )

enableTelemetryOption :: Config.Option Bool
enableTelemetryOption :: Option Bool
enableTelemetryOption =
  Option :: forall def. def -> String -> String -> Option def
Config.Option
    { _default :: Bool
_default = Bool
True,
      _envVar :: String
_envVar = String
"HASURA_GRAPHQL_ENABLE_TELEMETRY",
      _helpMessage :: String
_helpMessage = String
"Enable anonymous telemetry on the server and console. For more information, see: https://hasura.io/docs/latest/guides/telemetry (default: true)"
    }

parseWsReadCookie :: Opt.Parser Bool
parseWsReadCookie :: Parser Bool
parseWsReadCookie =
  Mod FlagFields Bool -> Parser Bool
Opt.switch
    ( String -> Mod FlagFields Bool
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"ws-read-cookie"
        Mod FlagFields Bool -> Mod FlagFields Bool -> Mod FlagFields Bool
forall a. Semigroup a => a -> a -> a
<> String -> Mod FlagFields Bool
forall (f :: * -> *) a. String -> Mod f a
Opt.help (Option Bool -> String
forall def. Option def -> String
Config._helpMessage Option Bool
wsReadCookieOption)
    )

wsReadCookieOption :: Config.Option Bool
wsReadCookieOption :: Option Bool
wsReadCookieOption =
  Option :: forall def. def -> String -> String -> Option def
Config.Option
    { _default :: Bool
Config._default = Bool
False,
      _envVar :: String
Config._envVar = String
"HASURA_GRAPHQL_WS_READ_COOKIE",
      _helpMessage :: String
Config._helpMessage =
        String
"Read cookie on WebSocket initial handshake, even when CORS is disabled."
          String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" This can be a potential security flaw! Please make sure you know "
          String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"what you're doing."
          String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" This configuration is only applicable when CORS is disabled."
    }

parseStringifyNum :: Opt.Parser Options.StringifyNumbers
parseStringifyNum :: Parser StringifyNumbers
parseStringifyNum =
  (Bool -> StringifyNumbers)
-> Parser Bool -> Parser StringifyNumbers
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (StringifyNumbers -> StringifyNumbers -> Bool -> StringifyNumbers
forall a. a -> a -> Bool -> a
bool StringifyNumbers
Options.Don'tStringifyNumbers StringifyNumbers
Options.StringifyNumbers) (Parser Bool -> Parser StringifyNumbers)
-> Parser Bool -> Parser StringifyNumbers
forall a b. (a -> b) -> a -> b
$
    Mod FlagFields Bool -> Parser Bool
Opt.switch
      ( String -> Mod FlagFields Bool
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"stringify-numeric-types"
          Mod FlagFields Bool -> Mod FlagFields Bool -> Mod FlagFields Bool
forall a. Semigroup a => a -> a -> a
<> String -> Mod FlagFields Bool
forall (f :: * -> *) a. String -> Mod f a
Opt.help (Option StringifyNumbers -> String
forall def. Option def -> String
Config._helpMessage Option StringifyNumbers
stringifyNumOption)
      )

stringifyNumOption :: Config.Option Options.StringifyNumbers
stringifyNumOption :: Option StringifyNumbers
stringifyNumOption =
  Option :: forall def. def -> String -> String -> Option def
Config.Option
    { _default :: StringifyNumbers
Config._default = StringifyNumbers
Options.Don'tStringifyNumbers,
      _envVar :: String
Config._envVar = String
"HASURA_GRAPHQL_STRINGIFY_NUMERIC_TYPES",
      _helpMessage :: String
Config._helpMessage = String
"Stringify numeric types (default: false)"
    }

parseDangerousBooleanCollapse :: Opt.Parser (Maybe Options.DangerouslyCollapseBooleans)
parseDangerousBooleanCollapse :: Parser (Maybe DangerouslyCollapseBooleans)
parseDangerousBooleanCollapse =
  Parser DangerouslyCollapseBooleans
-> Parser (Maybe DangerouslyCollapseBooleans)
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
Opt.optional (Parser DangerouslyCollapseBooleans
 -> Parser (Maybe DangerouslyCollapseBooleans))
-> Parser DangerouslyCollapseBooleans
-> Parser (Maybe DangerouslyCollapseBooleans)
forall a b. (a -> b) -> a -> b
$
    ReadM DangerouslyCollapseBooleans
-> Mod OptionFields DangerouslyCollapseBooleans
-> Parser DangerouslyCollapseBooleans
forall a. ReadM a -> Mod OptionFields a -> Parser a
Opt.option
      ((String -> Either String DangerouslyCollapseBooleans)
-> ReadM DangerouslyCollapseBooleans
forall a. (String -> Either String a) -> ReadM a
Opt.eitherReader String -> Either String DangerouslyCollapseBooleans
forall a. FromEnv a => String -> Either String a
Env.fromEnv)
      ( String -> Mod OptionFields DangerouslyCollapseBooleans
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"v1-boolean-null-collapse"
          Mod OptionFields DangerouslyCollapseBooleans
-> Mod OptionFields DangerouslyCollapseBooleans
-> Mod OptionFields DangerouslyCollapseBooleans
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields DangerouslyCollapseBooleans
forall (f :: * -> *) a. String -> Mod f a
Opt.help (Option DangerouslyCollapseBooleans -> String
forall def. Option def -> String
Config._helpMessage Option DangerouslyCollapseBooleans
dangerousBooleanCollapseOption)
      )

dangerousBooleanCollapseOption :: Config.Option Options.DangerouslyCollapseBooleans
dangerousBooleanCollapseOption :: Option DangerouslyCollapseBooleans
dangerousBooleanCollapseOption =
  Option :: forall def. def -> String -> String -> Option def
Config.Option
    { _default :: DangerouslyCollapseBooleans
Config._default = DangerouslyCollapseBooleans
Options.Don'tDangerouslyCollapseBooleans,
      _envVar :: String
Config._envVar = String
"HASURA_GRAPHQL_V1_BOOLEAN_NULL_COLLAPSE",
      _helpMessage :: String
Config._helpMessage =
        String
"Emulate V1's behaviour re. boolean expression, where an explicit 'null'"
          String -> String -> String
forall a. Semigroup a => a -> a -> a
<> String
" value will be interpreted to mean that the field should be ignored"
          String -> String -> String
forall a. Semigroup a => a -> a -> a
<> String
" [DEPRECATED, WILL BE REMOVED SOON] (default: false)"
    }

parseEnabledAPIs :: Opt.Parser (Maybe (HashSet Config.API))
parseEnabledAPIs :: Parser (Maybe (HashSet API))
parseEnabledAPIs =
  Parser (HashSet API) -> Parser (Maybe (HashSet API))
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
Opt.optional (Parser (HashSet API) -> Parser (Maybe (HashSet API)))
-> Parser (HashSet API) -> Parser (Maybe (HashSet API))
forall a b. (a -> b) -> a -> b
$
    ReadM (HashSet API)
-> Mod OptionFields (HashSet API) -> Parser (HashSet API)
forall a. ReadM a -> Mod OptionFields a -> Parser a
Opt.option
      ((String -> Either String (HashSet API)) -> ReadM (HashSet API)
forall a. (String -> Either String a) -> ReadM a
Opt.eitherReader String -> Either String (HashSet API)
forall a. FromEnv a => String -> Either String a
Env.fromEnv)
      ( String -> Mod OptionFields (HashSet API)
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"enabled-apis"
          Mod OptionFields (HashSet API)
-> Mod OptionFields (HashSet API) -> Mod OptionFields (HashSet API)
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields (HashSet API)
forall (f :: * -> *) a. String -> Mod f a
Opt.help (Option (HashSet API) -> String
forall def. Option def -> String
Config._helpMessage Option (HashSet API)
enabledAPIsOption)
      )

enabledAPIsOption :: Config.Option (HashSet Config.API)
enabledAPIsOption :: Option (HashSet API)
enabledAPIsOption =
  Option :: forall def. def -> String -> String -> Option def
Config.Option
    { _default :: HashSet API
Config._default = [API] -> HashSet API
forall a. (Eq a, Hashable a) => [a] -> HashSet a
HashSet.fromList [API
Config.METADATA, API
Config.GRAPHQL, API
Config.PGDUMP, API
Config.CONFIG],
      _envVar :: String
Config._envVar = String
"HASURA_GRAPHQL_ENABLED_APIS",
      _helpMessage :: String
Config._helpMessage = String
"Comma separated list of enabled APIs. (default: metadata,graphql,pgdump,config)"
    }

parseMxRefetchDelay :: Opt.Parser (Maybe Subscription.Options.RefetchInterval)
parseMxRefetchDelay :: Parser (Maybe RefetchInterval)
parseMxRefetchDelay =
  Parser RefetchInterval -> Parser (Maybe RefetchInterval)
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
Opt.optional (Parser RefetchInterval -> Parser (Maybe RefetchInterval))
-> Parser RefetchInterval -> Parser (Maybe RefetchInterval)
forall a b. (a -> b) -> a -> b
$
    ReadM RefetchInterval
-> Mod OptionFields RefetchInterval -> Parser RefetchInterval
forall a. ReadM a -> Mod OptionFields a -> Parser a
Opt.option
      ((String -> Either String RefetchInterval) -> ReadM RefetchInterval
forall a. (String -> Either String a) -> ReadM a
Opt.eitherReader String -> Either String RefetchInterval
forall a. FromEnv a => String -> Either String a
Env.fromEnv)
      ( String -> Mod OptionFields RefetchInterval
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"live-queries-multiplexed-refetch-interval"
          Mod OptionFields RefetchInterval
-> Mod OptionFields RefetchInterval
-> Mod OptionFields RefetchInterval
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields RefetchInterval
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
Opt.metavar String
"<INTERVAL(ms)>"
          Mod OptionFields RefetchInterval
-> Mod OptionFields RefetchInterval
-> Mod OptionFields RefetchInterval
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields RefetchInterval
forall (f :: * -> *) a. String -> Mod f a
Opt.help (Option RefetchInterval -> String
forall def. Option def -> String
Config._envVar Option RefetchInterval
mxRefetchDelayOption)
      )

mxRefetchDelayOption :: Config.Option Subscription.Options.RefetchInterval
mxRefetchDelayOption :: Option RefetchInterval
mxRefetchDelayOption =
  Option :: forall def. def -> String -> String -> Option def
Config.Option
    { _default :: RefetchInterval
Config._default = NonNegativeDiffTime -> RefetchInterval
Subscription.Options.RefetchInterval NonNegativeDiffTime
1,
      _envVar :: String
Config._envVar = String
"HASURA_GRAPHQL_LIVE_QUERIES_MULTIPLEXED_REFETCH_INTERVAL",
      _helpMessage :: String
Config._helpMessage =
        String
"results will only be sent once in this interval (in milliseconds) for "
          String -> String -> String
forall a. Semigroup a => a -> a -> a
<> String
"live queries which can be multiplexed. Default: 1000 (1sec)"
    }

parseMxBatchSize :: Opt.Parser (Maybe Subscription.Options.BatchSize)
parseMxBatchSize :: Parser (Maybe BatchSize)
parseMxBatchSize =
  Parser BatchSize -> Parser (Maybe BatchSize)
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
Opt.optional (Parser BatchSize -> Parser (Maybe BatchSize))
-> Parser BatchSize -> Parser (Maybe BatchSize)
forall a b. (a -> b) -> a -> b
$
    ReadM BatchSize -> Mod OptionFields BatchSize -> Parser BatchSize
forall a. ReadM a -> Mod OptionFields a -> Parser a
Opt.option
      ((String -> Either String BatchSize) -> ReadM BatchSize
forall a. (String -> Either String a) -> ReadM a
Opt.eitherReader String -> Either String BatchSize
forall a. FromEnv a => String -> Either String a
Env.fromEnv)
      ( String -> Mod OptionFields BatchSize
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"live-queries-multiplexed-batch-size"
          Mod OptionFields BatchSize
-> Mod OptionFields BatchSize -> Mod OptionFields BatchSize
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields BatchSize
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
Opt.metavar String
"BATCH_SIZE"
          Mod OptionFields BatchSize
-> Mod OptionFields BatchSize -> Mod OptionFields BatchSize
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields BatchSize
forall (f :: * -> *) a. String -> Mod f a
Opt.help (Option BatchSize -> String
forall def. Option def -> String
Config._helpMessage Option BatchSize
mxBatchSizeOption)
      )

mxBatchSizeOption :: Config.Option Subscription.Options.BatchSize
mxBatchSizeOption :: Option BatchSize
mxBatchSizeOption =
  Option :: forall def. def -> String -> String -> Option def
Config.Option
    { _default :: BatchSize
_default = NonNegativeInt -> BatchSize
Subscription.Options.BatchSize (NonNegativeInt -> BatchSize) -> NonNegativeInt -> BatchSize
forall a b. (a -> b) -> a -> b
$ Int -> NonNegativeInt
Numeric.unsafeNonNegativeInt Int
100,
      _envVar :: String
_envVar = String
"HASURA_GRAPHQL_LIVE_QUERIES_MULTIPLEXED_BATCH_SIZE",
      _helpMessage :: String
_helpMessage =
        String
"multiplexed live queries are split into batches of the specified "
          String -> String -> String
forall a. Semigroup a => a -> a -> a
<> String
"size. Default 100. "
    }

parseStreamingMxRefetchDelay :: Opt.Parser (Maybe Subscription.Options.RefetchInterval)
parseStreamingMxRefetchDelay :: Parser (Maybe RefetchInterval)
parseStreamingMxRefetchDelay =
  Parser RefetchInterval -> Parser (Maybe RefetchInterval)
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
Opt.optional (Parser RefetchInterval -> Parser (Maybe RefetchInterval))
-> Parser RefetchInterval -> Parser (Maybe RefetchInterval)
forall a b. (a -> b) -> a -> b
$
    ReadM RefetchInterval
-> Mod OptionFields RefetchInterval -> Parser RefetchInterval
forall a. ReadM a -> Mod OptionFields a -> Parser a
Opt.option
      ((String -> Either String RefetchInterval) -> ReadM RefetchInterval
forall a. (String -> Either String a) -> ReadM a
Opt.eitherReader String -> Either String RefetchInterval
forall a. FromEnv a => String -> Either String a
Env.fromEnv)
      ( String -> Mod OptionFields RefetchInterval
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"streaming-queries-multiplexed-refetch-interval"
          Mod OptionFields RefetchInterval
-> Mod OptionFields RefetchInterval
-> Mod OptionFields RefetchInterval
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields RefetchInterval
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
Opt.metavar String
"<INTERVAL(ms)>"
          Mod OptionFields RefetchInterval
-> Mod OptionFields RefetchInterval
-> Mod OptionFields RefetchInterval
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields RefetchInterval
forall (f :: * -> *) a. String -> Mod f a
Opt.help (Option RefetchInterval -> String
forall def. Option def -> String
Config._helpMessage Option RefetchInterval
streamingMxRefetchDelayOption)
      )

streamingMxRefetchDelayOption :: Config.Option Subscription.Options.RefetchInterval
streamingMxRefetchDelayOption :: Option RefetchInterval
streamingMxRefetchDelayOption =
  Option :: forall def. def -> String -> String -> Option def
Config.Option
    { _default :: RefetchInterval
Config._default = NonNegativeDiffTime -> RefetchInterval
Subscription.Options.RefetchInterval NonNegativeDiffTime
1,
      _envVar :: String
Config._envVar = String
"HASURA_GRAPHQL_STREAMING_QUERIES_MULTIPLEXED_REFETCH_INTERVAL",
      _helpMessage :: String
Config._helpMessage =
        String
"results will only be sent once in this interval (in milliseconds) for "
          String -> String -> String
forall a. Semigroup a => a -> a -> a
<> String
"streaming queries which can be multiplexed. Default: 1000 (1sec)"
    }

parseStreamingMxBatchSize :: Opt.Parser (Maybe Subscription.Options.BatchSize)
parseStreamingMxBatchSize :: Parser (Maybe BatchSize)
parseStreamingMxBatchSize =
  Parser BatchSize -> Parser (Maybe BatchSize)
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
Opt.optional (Parser BatchSize -> Parser (Maybe BatchSize))
-> Parser BatchSize -> Parser (Maybe BatchSize)
forall a b. (a -> b) -> a -> b
$
    ReadM BatchSize -> Mod OptionFields BatchSize -> Parser BatchSize
forall a. ReadM a -> Mod OptionFields a -> Parser a
Opt.option
      ((String -> Either String BatchSize) -> ReadM BatchSize
forall a. (String -> Either String a) -> ReadM a
Opt.eitherReader String -> Either String BatchSize
forall a. FromEnv a => String -> Either String a
Env.fromEnv)
      ( String -> Mod OptionFields BatchSize
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"streaming-queries-multiplexed-batch-size"
          Mod OptionFields BatchSize
-> Mod OptionFields BatchSize -> Mod OptionFields BatchSize
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields BatchSize
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
Opt.metavar String
"BATCH_SIZE"
          Mod OptionFields BatchSize
-> Mod OptionFields BatchSize -> Mod OptionFields BatchSize
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields BatchSize
forall (f :: * -> *) a. String -> Mod f a
Opt.help (Option BatchSize -> String
forall def. Option def -> String
Config._helpMessage Option BatchSize
streamingMxBatchSizeOption)
      )

streamingMxBatchSizeOption :: Config.Option Subscription.Options.BatchSize
streamingMxBatchSizeOption :: Option BatchSize
streamingMxBatchSizeOption =
  Option :: forall def. def -> String -> String -> Option def
Config.Option
    { _default :: BatchSize
Config._default = NonNegativeInt -> BatchSize
Subscription.Options.BatchSize (NonNegativeInt -> BatchSize) -> NonNegativeInt -> BatchSize
forall a b. (a -> b) -> a -> b
$ Int -> NonNegativeInt
Numeric.unsafeNonNegativeInt Int
100,
      _envVar :: String
Config._envVar = String
"HASURA_GRAPHQL_STREAMING_QUERIES_MULTIPLEXED_BATCH_SIZE",
      _helpMessage :: String
Config._helpMessage =
        String
"multiplexed live queries are split into batches of the specified "
          String -> String -> String
forall a. Semigroup a => a -> a -> a
<> String
"size. Default 100. "
    }

parseEnableAllowlist :: Opt.Parser Bool
parseEnableAllowlist :: Parser Bool
parseEnableAllowlist =
  Mod FlagFields Bool -> Parser Bool
Opt.switch
    ( String -> Mod FlagFields Bool
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"enable-allowlist"
        Mod FlagFields Bool -> Mod FlagFields Bool -> Mod FlagFields Bool
forall a. Semigroup a => a -> a -> a
<> String -> Mod FlagFields Bool
forall (f :: * -> *) a. String -> Mod f a
Opt.help (Option Bool -> String
forall def. Option def -> String
Config._helpMessage Option Bool
enableAllowlistOption)
    )

enableAllowlistOption :: Config.Option Bool
enableAllowlistOption :: Option Bool
enableAllowlistOption =
  Option :: forall def. def -> String -> String -> Option def
Config.Option
    { _default :: Bool
Config._default = Bool
False,
      _envVar :: String
Config._envVar = String
"HASURA_GRAPHQL_ENABLE_ALLOWLIST",
      _helpMessage :: String
Config._helpMessage = String
"Only accept allowed GraphQL queries"
    }

parseEnabledLogs :: forall impl. Logging.EnabledLogTypes impl => Opt.Parser (Maybe (HashSet (Logging.EngineLogType impl)))
parseEnabledLogs :: Parser (Maybe (HashSet (EngineLogType impl)))
parseEnabledLogs =
  Parser (HashSet (EngineLogType impl))
-> Parser (Maybe (HashSet (EngineLogType impl)))
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
Opt.optional (Parser (HashSet (EngineLogType impl))
 -> Parser (Maybe (HashSet (EngineLogType impl))))
-> Parser (HashSet (EngineLogType impl))
-> Parser (Maybe (HashSet (EngineLogType impl)))
forall a b. (a -> b) -> a -> b
$
    ReadM (HashSet (EngineLogType impl))
-> Mod OptionFields (HashSet (EngineLogType impl))
-> Parser (HashSet (EngineLogType impl))
forall a. ReadM a -> Mod OptionFields a -> Parser a
Opt.option
      ((String -> Either String (HashSet (EngineLogType impl)))
-> ReadM (HashSet (EngineLogType impl))
forall a. (String -> Either String a) -> ReadM a
Opt.eitherReader String -> Either String (HashSet (EngineLogType impl))
forall a. FromEnv a => String -> Either String a
Env.fromEnv)
      ( String -> Mod OptionFields (HashSet (EngineLogType impl))
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"enabled-log-types"
          Mod OptionFields (HashSet (EngineLogType impl))
-> Mod OptionFields (HashSet (EngineLogType impl))
-> Mod OptionFields (HashSet (EngineLogType impl))
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields (HashSet (EngineLogType impl))
forall (f :: * -> *) a. String -> Mod f a
Opt.help (Option (HashSet (EngineLogType impl)) -> String
forall def. Option def -> String
Config._helpMessage (EnabledLogTypes impl => Option (HashSet (EngineLogType impl))
forall impl.
EnabledLogTypes impl =>
Option (HashSet (EngineLogType impl))
enabledLogsOption @impl))
      )

enabledLogsOption :: Logging.EnabledLogTypes impl => Config.Option (HashSet (Logging.EngineLogType impl))
enabledLogsOption :: Option (HashSet (EngineLogType impl))
enabledLogsOption =
  Option :: forall def. def -> String -> String -> Option def
Config.Option
    { _default :: HashSet (EngineLogType impl)
Config._default = HashSet (EngineLogType impl)
forall impl. EnabledLogTypes impl => HashSet (EngineLogType impl)
Logging.defaultEnabledLogTypes,
      _envVar :: String
Config._envVar = String
"HASURA_GRAPHQL_ENABLED_LOG_TYPES",
      _helpMessage :: String
Config._helpMessage =
        String
"Comma separated list of enabled log types "
          String -> String -> String
forall a. Semigroup a => a -> a -> a
<> String
"(default: "
          String -> String -> String
forall a. Semigroup a => a -> a -> a
<> String
defaultLogTypes
          String -> String -> String
forall a. Semigroup a => a -> a -> a
<> String
")"
          String -> String -> String
forall a. Semigroup a => a -> a -> a
<> String
"(all: "
          String -> String -> String
forall a. Semigroup a => a -> a -> a
<> String
allAllowedLogTypes
          String -> String -> String
forall a. Semigroup a => a -> a -> a
<> String
")"
    }
  where
    defaultLogTypes :: String
defaultLogTypes = Text -> String
Text.unpack (Text -> String) -> ([Text] -> Text) -> [Text] -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> [Text] -> Text
Text.intercalate Text
"," ([Text] -> String) -> [Text] -> String
forall a b. (a -> b) -> a -> b
$ forall source. From source Text => source -> Text
forall target source. From source target => source -> target
Witch.into @Text (EngineLogType Hasura -> Text) -> [EngineLogType Hasura] -> [Text]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> HashSet (EngineLogType Hasura) -> [EngineLogType Hasura]
forall a. HashSet a -> [a]
HashSet.toList HashSet (EngineLogType Hasura)
Logging.defaultEnabledEngineLogTypes
    allAllowedLogTypes :: String
allAllowedLogTypes = Text -> String
Text.unpack (Text -> String) -> ([Text] -> Text) -> [Text] -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> [Text] -> Text
Text.intercalate Text
"," ([Text] -> String) -> [Text] -> String
forall a b. (a -> b) -> a -> b
$ forall source. From source Text => source -> Text
forall target source. From source target => source -> target
Witch.into @Text (EngineLogType Hasura -> Text) -> [EngineLogType Hasura] -> [Text]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [EngineLogType Hasura]
Logging.userAllowedLogTypes

parseLogLevel :: Opt.Parser (Maybe Logging.LogLevel)
parseLogLevel :: Parser (Maybe LogLevel)
parseLogLevel =
  Parser LogLevel -> Parser (Maybe LogLevel)
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
Opt.optional (Parser LogLevel -> Parser (Maybe LogLevel))
-> Parser LogLevel -> Parser (Maybe LogLevel)
forall a b. (a -> b) -> a -> b
$
    ReadM LogLevel -> Mod OptionFields LogLevel -> Parser LogLevel
forall a. ReadM a -> Mod OptionFields a -> Parser a
Opt.option
      ((String -> Either String LogLevel) -> ReadM LogLevel
forall a. (String -> Either String a) -> ReadM a
Opt.eitherReader String -> Either String LogLevel
forall a. FromEnv a => String -> Either String a
Env.fromEnv)
      ( String -> Mod OptionFields LogLevel
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"log-level"
          Mod OptionFields LogLevel
-> Mod OptionFields LogLevel -> Mod OptionFields LogLevel
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields LogLevel
forall (f :: * -> *) a. String -> Mod f a
Opt.help (Option LogLevel -> String
forall def. Option def -> String
Config._helpMessage Option LogLevel
logLevelOption)
      )

logLevelOption :: Config.Option Logging.LogLevel
logLevelOption :: Option LogLevel
logLevelOption =
  Option :: forall def. def -> String -> String -> Option def
Config.Option
    { _default :: LogLevel
Config._default = LogLevel
Logging.LevelInfo,
      _envVar :: String
Config._envVar = String
"HASURA_GRAPHQL_LOG_LEVEL",
      _helpMessage :: String
Config._helpMessage = String
"Server log level (default: info) (all: error, warn, info, debug)"
    }

parsePlanCacheSize :: Opt.Parser (Maybe Bounded.CacheSize)
parsePlanCacheSize :: Parser (Maybe CacheSize)
parsePlanCacheSize =
  Parser CacheSize -> Parser (Maybe CacheSize)
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
Opt.optional (Parser CacheSize -> Parser (Maybe CacheSize))
-> Parser CacheSize -> Parser (Maybe CacheSize)
forall a b. (a -> b) -> a -> b
$
    ReadM CacheSize -> Mod OptionFields CacheSize -> Parser CacheSize
forall a. ReadM a -> Mod OptionFields a -> Parser a
Opt.option
      ((String -> Either String CacheSize) -> ReadM CacheSize
forall a. (String -> Either String a) -> ReadM a
Opt.eitherReader String -> Either String CacheSize
forall a. FromEnv a => String -> Either String a
Env.fromEnv)
      ( String -> Mod OptionFields CacheSize
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"query-plan-cache-size"
          Mod OptionFields CacheSize
-> Mod OptionFields CacheSize -> Mod OptionFields CacheSize
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields CacheSize
forall (f :: * -> *) a. String -> Mod f a
Opt.help
            ( String
"[DEPRECATED: value ignored.] The maximum number of query plans "
                String -> String -> String
forall a. Semigroup a => a -> a -> a
<> String
"that can be cached, allowed values: 0-65535, "
                String -> String -> String
forall a. Semigroup a => a -> a -> a
<> String
"0 disables the cache. Default 4000"
            )
      )

parseGraphqlDevMode :: Opt.Parser Bool
parseGraphqlDevMode :: Parser Bool
parseGraphqlDevMode =
  Mod FlagFields Bool -> Parser Bool
Opt.switch
    ( String -> Mod FlagFields Bool
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"dev-mode"
        Mod FlagFields Bool -> Mod FlagFields Bool -> Mod FlagFields Bool
forall a. Semigroup a => a -> a -> a
<> String -> Mod FlagFields Bool
forall (f :: * -> *) a. String -> Mod f a
Opt.help (Option Bool -> String
forall def. Option def -> String
Config._helpMessage Option Bool
graphqlDevModeOption)
    )

graphqlDevModeOption :: Config.Option Bool
graphqlDevModeOption :: Option Bool
graphqlDevModeOption =
  Option :: forall def. def -> String -> String -> Option def
Config.Option
    { _default :: Bool
Config._default = Bool
False,
      _envVar :: String
Config._envVar = String
"HASURA_GRAPHQL_DEV_MODE",
      _helpMessage :: String
Config._helpMessage = String
"Set dev mode for GraphQL requests; include 'internal' key in the errors extensions (if required) of the response"
    }

parseGraphqlAdminInternalErrors :: Opt.Parser (Maybe Bool)
parseGraphqlAdminInternalErrors :: Parser (Maybe Bool)
parseGraphqlAdminInternalErrors =
  Parser Bool -> Parser (Maybe Bool)
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
Opt.optional (Parser Bool -> Parser (Maybe Bool))
-> Parser Bool -> Parser (Maybe Bool)
forall a b. (a -> b) -> a -> b
$
    ReadM Bool -> Mod OptionFields Bool -> Parser Bool
forall a. ReadM a -> Mod OptionFields a -> Parser a
Opt.option
      ((String -> Either String Bool) -> ReadM Bool
forall a. (String -> Either String a) -> ReadM a
Opt.eitherReader String -> Either String Bool
forall a. FromEnv a => String -> Either String a
Env.fromEnv)
      ( String -> Mod OptionFields Bool
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"admin-internal-errors"
          Mod OptionFields Bool
-> Mod OptionFields Bool -> Mod OptionFields Bool
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields Bool
forall (f :: * -> *) a. String -> Mod f a
Opt.help (Option Bool -> String
forall def. Option def -> String
Config._helpMessage Option Bool
graphqlAdminInternalErrorsOption)
      )

graphqlAdminInternalErrorsOption :: Config.Option Bool
graphqlAdminInternalErrorsOption :: Option Bool
graphqlAdminInternalErrorsOption =
  Option :: forall def. def -> String -> String -> Option def
Config.Option
    { -- Default to `true` to enable backwards compatibility
      _default :: Bool
Config._default = Bool
True,
      _envVar :: String
Config._envVar = String
"HASURA_GRAPHQL_ADMIN_INTERNAL_ERRORS",
      _helpMessage :: String
Config._helpMessage = String
"Enables including 'internal' information in an error response for requests made by an 'admin' (default: true)"
    }

parseGraphqlEventsHttpPoolSize :: Opt.Parser (Maybe Numeric.PositiveInt)
parseGraphqlEventsHttpPoolSize :: Parser (Maybe PositiveInt)
parseGraphqlEventsHttpPoolSize =
  Parser PositiveInt -> Parser (Maybe PositiveInt)
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
Opt.optional (Parser PositiveInt -> Parser (Maybe PositiveInt))
-> Parser PositiveInt -> Parser (Maybe PositiveInt)
forall a b. (a -> b) -> a -> b
$
    ReadM PositiveInt
-> Mod OptionFields PositiveInt -> Parser PositiveInt
forall a. ReadM a -> Mod OptionFields a -> Parser a
Opt.option
      ((String -> Either String PositiveInt) -> ReadM PositiveInt
forall a. (String -> Either String a) -> ReadM a
Opt.eitherReader String -> Either String PositiveInt
forall a. FromEnv a => String -> Either String a
Env.fromEnv)
      ( String -> Mod OptionFields PositiveInt
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"events-http-pool-size"
          Mod OptionFields PositiveInt
-> Mod OptionFields PositiveInt -> Mod OptionFields PositiveInt
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields PositiveInt
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
Opt.metavar (Option PositiveInt -> String
forall def. Option def -> String
Config._envVar Option PositiveInt
graphqlEventsHttpPoolSizeOption)
          Mod OptionFields PositiveInt
-> Mod OptionFields PositiveInt -> Mod OptionFields PositiveInt
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields PositiveInt
forall (f :: * -> *) a. String -> Mod f a
Opt.help (Option PositiveInt -> String
forall def. Option def -> String
Config._helpMessage Option PositiveInt
graphqlEventsHttpPoolSizeOption)
      )

graphqlEventsHttpPoolSizeOption :: Config.Option Numeric.PositiveInt
graphqlEventsHttpPoolSizeOption :: Option PositiveInt
graphqlEventsHttpPoolSizeOption =
  Option :: forall def. def -> String -> String -> Option def
Config.Option
    { _default :: PositiveInt
Config._default = Int -> PositiveInt
Numeric.unsafePositiveInt Int
100,
      _envVar :: String
Config._envVar = String
"HASURA_GRAPHQL_EVENTS_HTTP_POOL_SIZE",
      _helpMessage :: String
Config._helpMessage = String
"Max event processing threads (default: 100)"
    }

parseGraphqlEventsFetchInterval :: Opt.Parser (Maybe (Numeric.NonNegative Milliseconds))
parseGraphqlEventsFetchInterval :: Parser (Maybe (NonNegative Milliseconds))
parseGraphqlEventsFetchInterval =
  Parser (NonNegative Milliseconds)
-> Parser (Maybe (NonNegative Milliseconds))
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
Opt.optional (Parser (NonNegative Milliseconds)
 -> Parser (Maybe (NonNegative Milliseconds)))
-> Parser (NonNegative Milliseconds)
-> Parser (Maybe (NonNegative Milliseconds))
forall a b. (a -> b) -> a -> b
$
    ReadM (NonNegative Milliseconds)
-> Mod OptionFields (NonNegative Milliseconds)
-> Parser (NonNegative Milliseconds)
forall a. ReadM a -> Mod OptionFields a -> Parser a
Opt.option
      ((String -> Either String (NonNegative Milliseconds))
-> ReadM (NonNegative Milliseconds)
forall a. (String -> Either String a) -> ReadM a
Opt.eitherReader String -> Either String (NonNegative Milliseconds)
forall a. FromEnv a => String -> Either String a
Env.fromEnv)
      ( String -> Mod OptionFields (NonNegative Milliseconds)
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"events-fetch-interval"
          Mod OptionFields (NonNegative Milliseconds)
-> Mod OptionFields (NonNegative Milliseconds)
-> Mod OptionFields (NonNegative Milliseconds)
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields (NonNegative Milliseconds)
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
Opt.metavar (Option (NonNegative Milliseconds) -> String
forall def. Option def -> String
Config._envVar Option (NonNegative Milliseconds)
graphqlEventsFetchIntervalOption)
          Mod OptionFields (NonNegative Milliseconds)
-> Mod OptionFields (NonNegative Milliseconds)
-> Mod OptionFields (NonNegative Milliseconds)
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields (NonNegative Milliseconds)
forall (f :: * -> *) a. String -> Mod f a
Opt.help (Option (NonNegative Milliseconds) -> String
forall def. Option def -> String
Config._helpMessage Option (NonNegative Milliseconds)
graphqlEventsFetchIntervalOption)
      )

graphqlEventsFetchIntervalOption :: Config.Option (Numeric.NonNegative Milliseconds)
graphqlEventsFetchIntervalOption :: Option (NonNegative Milliseconds)
graphqlEventsFetchIntervalOption =
  Option :: forall def. def -> String -> String -> Option def
Config.Option
    { _default :: NonNegative Milliseconds
Config._default = Milliseconds -> NonNegative Milliseconds
forall a. a -> NonNegative a
Numeric.unsafeNonNegative (Milliseconds
1000 :: Milliseconds),
      _envVar :: String
Config._envVar = String
"HASURA_GRAPHQL_EVENTS_FETCH_INTERVAL",
      _helpMessage :: String
Config._helpMessage = String
"Interval in milliseconds to sleep before trying to fetch events again after a fetch returned no events from postgres (default: 1 second)."
    }

parseGraphqlAsyncActionsFetchInterval :: Opt.Parser (Maybe Config.OptionalInterval)
parseGraphqlAsyncActionsFetchInterval :: Parser (Maybe OptionalInterval)
parseGraphqlAsyncActionsFetchInterval =
  Parser OptionalInterval -> Parser (Maybe OptionalInterval)
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
Opt.optional (Parser OptionalInterval -> Parser (Maybe OptionalInterval))
-> Parser OptionalInterval -> Parser (Maybe OptionalInterval)
forall a b. (a -> b) -> a -> b
$
    ReadM OptionalInterval
-> Mod OptionFields OptionalInterval -> Parser OptionalInterval
forall a. ReadM a -> Mod OptionFields a -> Parser a
Opt.option
      ((String -> Either String OptionalInterval)
-> ReadM OptionalInterval
forall a. (String -> Either String a) -> ReadM a
Opt.eitherReader String -> Either String OptionalInterval
forall a. FromEnv a => String -> Either String a
Env.fromEnv)
      ( String -> Mod OptionFields OptionalInterval
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"async-actions-fetch-interval"
          Mod OptionFields OptionalInterval
-> Mod OptionFields OptionalInterval
-> Mod OptionFields OptionalInterval
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields OptionalInterval
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
Opt.metavar (Option OptionalInterval -> String
forall def. Option def -> String
Config._envVar Option OptionalInterval
asyncActionsFetchIntervalOption)
          Mod OptionFields OptionalInterval
-> Mod OptionFields OptionalInterval
-> Mod OptionFields OptionalInterval
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields OptionalInterval
forall (f :: * -> *) a. String -> Mod f a
Opt.help (Option OptionalInterval -> String
forall def. Option def -> String
Config._helpMessage Option OptionalInterval
asyncActionsFetchIntervalOption)
      )

asyncActionsFetchIntervalOption :: Config.Option Config.OptionalInterval
asyncActionsFetchIntervalOption :: Option OptionalInterval
asyncActionsFetchIntervalOption =
  Option :: forall def. def -> String -> String -> Option def
Config.Option
    { _default :: OptionalInterval
Config._default = NonNegative Milliseconds -> OptionalInterval
Config.Interval (NonNegative Milliseconds -> OptionalInterval)
-> NonNegative Milliseconds -> OptionalInterval
forall a b. (a -> b) -> a -> b
$ Milliseconds -> NonNegative Milliseconds
forall a. a -> NonNegative a
Numeric.unsafeNonNegative (Milliseconds
1000 :: Milliseconds),
      _envVar :: String
Config._envVar = String
"HASURA_GRAPHQL_ASYNC_ACTIONS_FETCH_INTERVAL",
      _helpMessage :: String
Config._helpMessage =
        String
"Interval in milliseconds to sleep before trying to fetch new async actions. "
          String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"Value \"0\" implies completely disable fetching async actions from storage. "
          String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"Default 1000 milliseconds"
    }

parseEnableRemoteSchemaPerms :: Opt.Parser Options.RemoteSchemaPermissions
parseEnableRemoteSchemaPerms :: Parser RemoteSchemaPermissions
parseEnableRemoteSchemaPerms =
  (Bool -> RemoteSchemaPermissions)
-> Parser Bool -> Parser RemoteSchemaPermissions
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (RemoteSchemaPermissions
-> RemoteSchemaPermissions -> Bool -> RemoteSchemaPermissions
forall a. a -> a -> Bool -> a
bool RemoteSchemaPermissions
Options.DisableRemoteSchemaPermissions RemoteSchemaPermissions
Options.EnableRemoteSchemaPermissions) (Parser Bool -> Parser RemoteSchemaPermissions)
-> Parser Bool -> Parser RemoteSchemaPermissions
forall a b. (a -> b) -> a -> b
$
    Mod FlagFields Bool -> Parser Bool
Opt.switch
      ( String -> Mod FlagFields Bool
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"enable-remote-schema-permissions"
          Mod FlagFields Bool -> Mod FlagFields Bool -> Mod FlagFields Bool
forall a. Semigroup a => a -> a -> a
<> String -> Mod FlagFields Bool
forall (f :: * -> *) a. String -> Mod f a
Opt.help (Option RemoteSchemaPermissions -> String
forall def. Option def -> String
Config._helpMessage Option RemoteSchemaPermissions
enableRemoteSchemaPermsOption)
      )

enableRemoteSchemaPermsOption :: Config.Option Options.RemoteSchemaPermissions
enableRemoteSchemaPermsOption :: Option RemoteSchemaPermissions
enableRemoteSchemaPermsOption =
  Option :: forall def. def -> String -> String -> Option def
Config.Option
    { _default :: RemoteSchemaPermissions
Config._default = RemoteSchemaPermissions
Options.DisableRemoteSchemaPermissions,
      _envVar :: String
Config._envVar = String
"HASURA_GRAPHQL_ENABLE_REMOTE_SCHEMA_PERMISSIONS",
      _helpMessage :: String
Config._helpMessage = String
"Enables remote schema permissions (default: false)"
    }

parseWebSocketCompression :: Opt.Parser Bool
parseWebSocketCompression :: Parser Bool
parseWebSocketCompression =
  Mod FlagFields Bool -> Parser Bool
Opt.switch
    ( String -> Mod FlagFields Bool
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"websocket-compression"
        Mod FlagFields Bool -> Mod FlagFields Bool -> Mod FlagFields Bool
forall a. Semigroup a => a -> a -> a
<> String -> Mod FlagFields Bool
forall (f :: * -> *) a. String -> Mod f a
Opt.help (Option Bool -> String
forall def. Option def -> String
Config._helpMessage Option Bool
webSocketCompressionOption)
    )

webSocketCompressionOption :: Config.Option Bool
webSocketCompressionOption :: Option Bool
webSocketCompressionOption =
  Option :: forall def. def -> String -> String -> Option def
Config.Option
    { _default :: Bool
Config._default = Bool
False,
      _envVar :: String
Config._envVar = String
"HASURA_GRAPHQL_CONNECTION_COMPRESSION",
      _helpMessage :: String
Config._helpMessage = String
"Enable WebSocket permessage-deflate compression (default: false)"
    }

parseWebSocketKeepAlive :: Opt.Parser (Maybe Config.KeepAliveDelay)
parseWebSocketKeepAlive :: Parser (Maybe KeepAliveDelay)
parseWebSocketKeepAlive =
  Parser KeepAliveDelay -> Parser (Maybe KeepAliveDelay)
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
Opt.optional (Parser KeepAliveDelay -> Parser (Maybe KeepAliveDelay))
-> Parser KeepAliveDelay -> Parser (Maybe KeepAliveDelay)
forall a b. (a -> b) -> a -> b
$
    ReadM KeepAliveDelay
-> Mod OptionFields KeepAliveDelay -> Parser KeepAliveDelay
forall a. ReadM a -> Mod OptionFields a -> Parser a
Opt.option
      ((String -> Either String KeepAliveDelay) -> ReadM KeepAliveDelay
forall a. (String -> Either String a) -> ReadM a
Opt.eitherReader String -> Either String KeepAliveDelay
forall a. FromEnv a => String -> Either String a
Env.fromEnv)
      ( String -> Mod OptionFields KeepAliveDelay
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"websocket-keepalive"
          Mod OptionFields KeepAliveDelay
-> Mod OptionFields KeepAliveDelay
-> Mod OptionFields KeepAliveDelay
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields KeepAliveDelay
forall (f :: * -> *) a. String -> Mod f a
Opt.help (Option KeepAliveDelay -> String
forall def. Option def -> String
Config._helpMessage Option KeepAliveDelay
webSocketKeepAliveOption)
      )

-- NOTE: this is purely used by Apollo-Subscription-Transport-WS
webSocketKeepAliveOption :: Config.Option Config.KeepAliveDelay
webSocketKeepAliveOption :: Option KeepAliveDelay
webSocketKeepAliveOption =
  Option :: forall def. def -> String -> String -> Option def
Config.Option
    { _default :: KeepAliveDelay
Config._default = NonNegative Seconds -> KeepAliveDelay
Config.KeepAliveDelay (NonNegative Seconds -> KeepAliveDelay)
-> NonNegative Seconds -> KeepAliveDelay
forall a b. (a -> b) -> a -> b
$ Seconds -> NonNegative Seconds
forall a. a -> NonNegative a
Numeric.unsafeNonNegative (Seconds
5 :: Seconds),
      _envVar :: String
Config._envVar = String
"HASURA_GRAPHQL_WEBSOCKET_KEEPALIVE",
      _helpMessage :: String
Config._helpMessage = String
"Control websocket keep-alive timeout (default 5 seconds)"
    }

parseInferFunctionPerms :: Opt.Parser (Maybe Options.InferFunctionPermissions)
parseInferFunctionPerms :: Parser (Maybe InferFunctionPermissions)
parseInferFunctionPerms =
  Parser InferFunctionPermissions
-> Parser (Maybe InferFunctionPermissions)
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
Opt.optional (Parser InferFunctionPermissions
 -> Parser (Maybe InferFunctionPermissions))
-> Parser InferFunctionPermissions
-> Parser (Maybe InferFunctionPermissions)
forall a b. (a -> b) -> a -> b
$
    ReadM InferFunctionPermissions
-> Mod OptionFields InferFunctionPermissions
-> Parser InferFunctionPermissions
forall a. ReadM a -> Mod OptionFields a -> Parser a
Opt.option
      ((String -> Either String InferFunctionPermissions)
-> ReadM InferFunctionPermissions
forall a. (String -> Either String a) -> ReadM a
Opt.eitherReader String -> Either String InferFunctionPermissions
forall a. FromEnv a => String -> Either String a
Env.fromEnv)
      ( String -> Mod OptionFields InferFunctionPermissions
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"infer-function-permissions"
          Mod OptionFields InferFunctionPermissions
-> Mod OptionFields InferFunctionPermissions
-> Mod OptionFields InferFunctionPermissions
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields InferFunctionPermissions
forall (f :: * -> *) a. String -> Mod f a
Opt.help (Option InferFunctionPermissions -> String
forall def. Option def -> String
Config._helpMessage Option InferFunctionPermissions
inferFunctionPermsOption)
      )

inferFunctionPermsOption :: Config.Option Options.InferFunctionPermissions
inferFunctionPermsOption :: Option InferFunctionPermissions
inferFunctionPermsOption =
  Option :: forall def. def -> String -> String -> Option def
Config.Option
    { _default :: InferFunctionPermissions
Config._default = InferFunctionPermissions
Options.InferFunctionPermissions,
      _envVar :: String
Config._envVar = String
"HASURA_GRAPHQL_INFER_FUNCTION_PERMISSIONS",
      _helpMessage :: String
Config._helpMessage = String
"Infers function permissions (default: true)"
    }

parseEnableMaintenanceMode :: Opt.Parser (Types.MaintenanceMode ())
parseEnableMaintenanceMode :: Parser (MaintenanceMode ())
parseEnableMaintenanceMode =
  (Bool -> MaintenanceMode ())
-> Parser Bool -> Parser (MaintenanceMode ())
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (MaintenanceMode ()
-> MaintenanceMode () -> Bool -> MaintenanceMode ()
forall a. a -> a -> Bool -> a
bool MaintenanceMode ()
forall a. MaintenanceMode a
Types.MaintenanceModeDisabled (() -> MaintenanceMode ()
forall a. a -> MaintenanceMode a
Types.MaintenanceModeEnabled ())) (Parser Bool -> Parser (MaintenanceMode ()))
-> Parser Bool -> Parser (MaintenanceMode ())
forall a b. (a -> b) -> a -> b
$
    Mod FlagFields Bool -> Parser Bool
Opt.switch
      ( String -> Mod FlagFields Bool
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"enable-maintenance-mode"
          Mod FlagFields Bool -> Mod FlagFields Bool -> Mod FlagFields Bool
forall a. Semigroup a => a -> a -> a
<> String -> Mod FlagFields Bool
forall (f :: * -> *) a. String -> Mod f a
Opt.help (Option (MaintenanceMode ()) -> String
forall def. Option def -> String
Config._helpMessage Option (MaintenanceMode ())
enableMaintenanceModeOption)
      )

enableMaintenanceModeOption :: Config.Option (Types.MaintenanceMode ())
enableMaintenanceModeOption :: Option (MaintenanceMode ())
enableMaintenanceModeOption =
  Option :: forall def. def -> String -> String -> Option def
Config.Option
    { _default :: MaintenanceMode ()
Config._default = MaintenanceMode ()
forall a. MaintenanceMode a
Types.MaintenanceModeDisabled,
      _envVar :: String
Config._envVar = String
"HASURA_GRAPHQL_ENABLE_MAINTENANCE_MODE",
      _helpMessage :: String
Config._helpMessage = String
"Flag to enable maintenance mode in the graphql-engine"
    }

parseSchemaPollInterval :: Opt.Parser (Maybe Config.OptionalInterval)
parseSchemaPollInterval :: Parser (Maybe OptionalInterval)
parseSchemaPollInterval =
  Parser OptionalInterval -> Parser (Maybe OptionalInterval)
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
Opt.optional (Parser OptionalInterval -> Parser (Maybe OptionalInterval))
-> Parser OptionalInterval -> Parser (Maybe OptionalInterval)
forall a b. (a -> b) -> a -> b
$
    ReadM OptionalInterval
-> Mod OptionFields OptionalInterval -> Parser OptionalInterval
forall a. ReadM a -> Mod OptionFields a -> Parser a
Opt.option
      ((String -> Either String OptionalInterval)
-> ReadM OptionalInterval
forall a. (String -> Either String a) -> ReadM a
Opt.eitherReader String -> Either String OptionalInterval
forall a. FromEnv a => String -> Either String a
Env.fromEnv)
      ( String -> Mod OptionFields OptionalInterval
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"schema-sync-poll-interval"
          Mod OptionFields OptionalInterval
-> Mod OptionFields OptionalInterval
-> Mod OptionFields OptionalInterval
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields OptionalInterval
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
Opt.metavar (Option OptionalInterval -> String
forall def. Option def -> String
Config._envVar Option OptionalInterval
schemaPollIntervalOption)
          Mod OptionFields OptionalInterval
-> Mod OptionFields OptionalInterval
-> Mod OptionFields OptionalInterval
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields OptionalInterval
forall (f :: * -> *) a. String -> Mod f a
Opt.help (Option OptionalInterval -> String
forall def. Option def -> String
Config._helpMessage Option OptionalInterval
schemaPollIntervalOption)
      )

schemaPollIntervalOption :: Config.Option Config.OptionalInterval
schemaPollIntervalOption :: Option OptionalInterval
schemaPollIntervalOption =
  Option :: forall def. def -> String -> String -> Option def
Config.Option
    { -- 1000 Milliseconds or 1 Second
      _default :: OptionalInterval
Config._default = NonNegative Milliseconds -> OptionalInterval
Config.Interval (NonNegative Milliseconds -> OptionalInterval)
-> NonNegative Milliseconds -> OptionalInterval
forall a b. (a -> b) -> a -> b
$ Milliseconds -> NonNegative Milliseconds
forall a. a -> NonNegative a
Numeric.unsafeNonNegative (Milliseconds
1000 :: Milliseconds),
      _envVar :: String
Config._envVar = String
"HASURA_GRAPHQL_SCHEMA_SYNC_POLL_INTERVAL",
      _helpMessage :: String
Config._helpMessage = String
"Interval to poll metadata storage for updates in milliseconds - Default 1000 (1s) - Set to 0 to disable"
    }

parseExperimentalFeatures :: Opt.Parser (Maybe (HashSet Types.ExperimentalFeature))
parseExperimentalFeatures :: Parser (Maybe (HashSet ExperimentalFeature))
parseExperimentalFeatures =
  Parser (HashSet ExperimentalFeature)
-> Parser (Maybe (HashSet ExperimentalFeature))
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
Opt.optional (Parser (HashSet ExperimentalFeature)
 -> Parser (Maybe (HashSet ExperimentalFeature)))
-> Parser (HashSet ExperimentalFeature)
-> Parser (Maybe (HashSet ExperimentalFeature))
forall a b. (a -> b) -> a -> b
$
    ReadM (HashSet ExperimentalFeature)
-> Mod OptionFields (HashSet ExperimentalFeature)
-> Parser (HashSet ExperimentalFeature)
forall a. ReadM a -> Mod OptionFields a -> Parser a
Opt.option
      ((String -> Either String (HashSet ExperimentalFeature))
-> ReadM (HashSet ExperimentalFeature)
forall a. (String -> Either String a) -> ReadM a
Opt.eitherReader String -> Either String (HashSet ExperimentalFeature)
forall a. FromEnv a => String -> Either String a
Env.fromEnv)
      ( String -> Mod OptionFields (HashSet ExperimentalFeature)
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"experimental-features"
          Mod OptionFields (HashSet ExperimentalFeature)
-> Mod OptionFields (HashSet ExperimentalFeature)
-> Mod OptionFields (HashSet ExperimentalFeature)
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields (HashSet ExperimentalFeature)
forall (f :: * -> *) a. String -> Mod f a
Opt.help (Option (HashSet ExperimentalFeature) -> String
forall def. Option def -> String
Config._helpMessage Option (HashSet ExperimentalFeature)
experimentalFeaturesOption)
      )

experimentalFeaturesOption :: Config.Option (HashSet Types.ExperimentalFeature)
experimentalFeaturesOption :: Option (HashSet ExperimentalFeature)
experimentalFeaturesOption =
  Option :: forall def. def -> String -> String -> Option def
Config.Option
    { _default :: HashSet ExperimentalFeature
Config._default = HashSet ExperimentalFeature
forall a. HashSet a
HashSet.empty,
      _envVar :: String
Config._envVar = String
"HASURA_GRAPHQL_EXPERIMENTAL_FEATURES",
      _helpMessage :: String
Config._helpMessage =
        String
"Comma separated list of experimental features. (all: inherited_roles,optimize_permission_filters and naming_convention, streaming_subscriptions, apollo_federation). "
          String -> String -> String
forall a. Semigroup a => a -> a -> a
<> String
"optimize_permission_filters: Use experimental SQL optimization"
          String -> String -> String
forall a. Semigroup a => a -> a -> a
<> String
"transformations for permission filters. "
          String -> String -> String
forall a. Semigroup a => a -> a -> a
<> String
"inherited_roles: ignored; inherited roles cannot be switched off"
          String -> String -> String
forall a. Semigroup a => a -> a -> a
<> String
"naming_convention: apply naming convention (graphql-default/hasura-default) based on source customization"
          String -> String -> String
forall a. Semigroup a => a -> a -> a
<> String
"apollo_federation: use hasura as a subgraph in an Apollo gateway"
          String -> String -> String
forall a. Semigroup a => a -> a -> a
<> String
"streaming_subscriptions: A streaming subscription streams the response according to the cursor provided by the user"
    }

parseEventsFetchBatchSize :: Opt.Parser (Maybe Numeric.NonNegativeInt)
parseEventsFetchBatchSize :: Parser (Maybe NonNegativeInt)
parseEventsFetchBatchSize =
  Parser NonNegativeInt -> Parser (Maybe NonNegativeInt)
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
Opt.optional (Parser NonNegativeInt -> Parser (Maybe NonNegativeInt))
-> Parser NonNegativeInt -> Parser (Maybe NonNegativeInt)
forall a b. (a -> b) -> a -> b
$
    ReadM NonNegativeInt
-> Mod OptionFields NonNegativeInt -> Parser NonNegativeInt
forall a. ReadM a -> Mod OptionFields a -> Parser a
Opt.option
      ((String -> Either String NonNegativeInt) -> ReadM NonNegativeInt
forall a. (String -> Either String a) -> ReadM a
Opt.eitherReader String -> Either String NonNegativeInt
forall a. FromEnv a => String -> Either String a
Env.fromEnv)
      ( String -> Mod OptionFields NonNegativeInt
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"events-fetch-batch-size"
          Mod OptionFields NonNegativeInt
-> Mod OptionFields NonNegativeInt
-> Mod OptionFields NonNegativeInt
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields NonNegativeInt
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
Opt.metavar (Option NonNegativeInt -> String
forall def. Option def -> String
Config._envVar Option NonNegativeInt
eventsFetchBatchSizeOption)
          Mod OptionFields NonNegativeInt
-> Mod OptionFields NonNegativeInt
-> Mod OptionFields NonNegativeInt
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields NonNegativeInt
forall (f :: * -> *) a. String -> Mod f a
Opt.help (Option NonNegativeInt -> String
forall def. Option def -> String
Config._helpMessage Option NonNegativeInt
eventsFetchBatchSizeOption)
      )

eventsFetchBatchSizeOption :: Config.Option Numeric.NonNegativeInt
eventsFetchBatchSizeOption :: Option NonNegativeInt
eventsFetchBatchSizeOption =
  Option :: forall def. def -> String -> String -> Option def
Config.Option
    { _default :: NonNegativeInt
Config._default = Int -> NonNegativeInt
Numeric.unsafeNonNegativeInt Int
100,
      _envVar :: String
Config._envVar = String
"HASURA_GRAPHQL_EVENTS_FETCH_BATCH_SIZE",
      _helpMessage :: String
Config._helpMessage =
        String
"The maximum number of events to be fetched from the events table in a single batch. Default 100"
          String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"Value \"0\" implies completely disable fetching events from events table. "
    }

parseGracefulShutdownTimeout :: Opt.Parser (Maybe (Numeric.NonNegative Seconds))
parseGracefulShutdownTimeout :: Parser (Maybe (NonNegative Seconds))
parseGracefulShutdownTimeout =
  Parser (NonNegative Seconds)
-> Parser (Maybe (NonNegative Seconds))
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
Opt.optional (Parser (NonNegative Seconds)
 -> Parser (Maybe (NonNegative Seconds)))
-> Parser (NonNegative Seconds)
-> Parser (Maybe (NonNegative Seconds))
forall a b. (a -> b) -> a -> b
$
    ReadM (NonNegative Seconds)
-> Mod OptionFields (NonNegative Seconds)
-> Parser (NonNegative Seconds)
forall a. ReadM a -> Mod OptionFields a -> Parser a
Opt.option
      ((String -> Either String (NonNegative Seconds))
-> ReadM (NonNegative Seconds)
forall a. (String -> Either String a) -> ReadM a
Opt.eitherReader String -> Either String (NonNegative Seconds)
forall a. FromEnv a => String -> Either String a
Env.fromEnv)
      ( String -> Mod OptionFields (NonNegative Seconds)
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"graceful-shutdown-timeout"
          Mod OptionFields (NonNegative Seconds)
-> Mod OptionFields (NonNegative Seconds)
-> Mod OptionFields (NonNegative Seconds)
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields (NonNegative Seconds)
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
Opt.metavar String
"<INTERVAL (seconds)>"
          Mod OptionFields (NonNegative Seconds)
-> Mod OptionFields (NonNegative Seconds)
-> Mod OptionFields (NonNegative Seconds)
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields (NonNegative Seconds)
forall (f :: * -> *) a. String -> Mod f a
Opt.help (Option (NonNegative Seconds) -> String
forall def. Option def -> String
Config._helpMessage Option (NonNegative Seconds)
gracefulShutdownOption)
      )

gracefulShutdownOption :: Config.Option (Numeric.NonNegative Seconds)
gracefulShutdownOption :: Option (NonNegative Seconds)
gracefulShutdownOption =
  Option :: forall def. def -> String -> String -> Option def
Config.Option
    { _default :: NonNegative Seconds
Config._default = Seconds -> NonNegative Seconds
forall a. a -> NonNegative a
Numeric.unsafeNonNegative (Seconds
60 :: Seconds),
      _envVar :: String
Config._envVar = String
"HASURA_GRAPHQL_GRACEFUL_SHUTDOWN_TIMEOUT",
      _helpMessage :: String
Config._helpMessage =
        String
"Timeout for graceful shutdown before which in-flight scheduled events, "
          String -> String -> String
forall a. Semigroup a => a -> a -> a
<> String
" cron events and async actions to complete (default: 60 seconds)"
    }

parseWebSocketConnectionInitTimeout :: Opt.Parser (Maybe Config.WSConnectionInitTimeout)
parseWebSocketConnectionInitTimeout :: Parser (Maybe WSConnectionInitTimeout)
parseWebSocketConnectionInitTimeout =
  Parser WSConnectionInitTimeout
-> Parser (Maybe WSConnectionInitTimeout)
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
Opt.optional (Parser WSConnectionInitTimeout
 -> Parser (Maybe WSConnectionInitTimeout))
-> Parser WSConnectionInitTimeout
-> Parser (Maybe WSConnectionInitTimeout)
forall a b. (a -> b) -> a -> b
$
    ReadM WSConnectionInitTimeout
-> Mod OptionFields WSConnectionInitTimeout
-> Parser WSConnectionInitTimeout
forall a. ReadM a -> Mod OptionFields a -> Parser a
Opt.option
      ((String -> Either String WSConnectionInitTimeout)
-> ReadM WSConnectionInitTimeout
forall a. (String -> Either String a) -> ReadM a
Opt.eitherReader String -> Either String WSConnectionInitTimeout
forall a. FromEnv a => String -> Either String a
Env.fromEnv)
      ( String -> Mod OptionFields WSConnectionInitTimeout
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"websocket-connection-init-timeout"
          Mod OptionFields WSConnectionInitTimeout
-> Mod OptionFields WSConnectionInitTimeout
-> Mod OptionFields WSConnectionInitTimeout
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields WSConnectionInitTimeout
forall (f :: * -> *) a. String -> Mod f a
Opt.help (Option WSConnectionInitTimeout -> String
forall def. Option def -> String
Config._helpMessage Option WSConnectionInitTimeout
webSocketConnectionInitTimeoutOption)
      )

-- NOTE: this is purely used by GraphQL-WS
webSocketConnectionInitTimeoutOption :: Config.Option Config.WSConnectionInitTimeout
webSocketConnectionInitTimeoutOption :: Option WSConnectionInitTimeout
webSocketConnectionInitTimeoutOption =
  Option :: forall def. def -> String -> String -> Option def
Config.Option
    { _default :: WSConnectionInitTimeout
Config._default = NonNegative Seconds -> WSConnectionInitTimeout
Config.WSConnectionInitTimeout (NonNegative Seconds -> WSConnectionInitTimeout)
-> NonNegative Seconds -> WSConnectionInitTimeout
forall a b. (a -> b) -> a -> b
$ Seconds -> NonNegative Seconds
forall a. a -> NonNegative a
Numeric.unsafeNonNegative Seconds
3,
      _envVar :: String
Config._envVar = String
"HASURA_GRAPHQL_WEBSOCKET_CONNECTION_INIT_TIMEOUT", -- FIXME?: maybe a better name
      _helpMessage :: String
Config._helpMessage = String
"Control websocket connection_init timeout (default 3 seconds)"
    }

parseEnableMetadataQueryLogging :: Opt.Parser Server.Logging.MetadataQueryLoggingMode
parseEnableMetadataQueryLogging :: Parser MetadataQueryLoggingMode
parseEnableMetadataQueryLogging =
  (Bool -> MetadataQueryLoggingMode)
-> Parser Bool -> Parser MetadataQueryLoggingMode
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (MetadataQueryLoggingMode
-> MetadataQueryLoggingMode -> Bool -> MetadataQueryLoggingMode
forall a. a -> a -> Bool -> a
bool MetadataQueryLoggingMode
Server.Logging.MetadataQueryLoggingDisabled MetadataQueryLoggingMode
Server.Logging.MetadataQueryLoggingEnabled) (Parser Bool -> Parser MetadataQueryLoggingMode)
-> Parser Bool -> Parser MetadataQueryLoggingMode
forall a b. (a -> b) -> a -> b
$
    Mod FlagFields Bool -> Parser Bool
Opt.switch
      ( String -> Mod FlagFields Bool
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"enable-metadata-query-logging"
          Mod FlagFields Bool -> Mod FlagFields Bool -> Mod FlagFields Bool
forall a. Semigroup a => a -> a -> a
<> String -> Mod FlagFields Bool
forall (f :: * -> *) a. String -> Mod f a
Opt.help (Option MetadataQueryLoggingMode -> String
forall def. Option def -> String
Config._helpMessage Option MetadataQueryLoggingMode
enableMetadataQueryLoggingOption)
      )

enableMetadataQueryLoggingOption :: Config.Option Server.Logging.MetadataQueryLoggingMode
enableMetadataQueryLoggingOption :: Option MetadataQueryLoggingMode
enableMetadataQueryLoggingOption =
  Option :: forall def. def -> String -> String -> Option def
Config.Option
    { _default :: MetadataQueryLoggingMode
Config._default = MetadataQueryLoggingMode
Server.Logging.MetadataQueryLoggingDisabled,
      _envVar :: String
Config._envVar = String
"HASURA_GRAPHQL_ENABLE_METADATA_QUERY_LOGGING",
      _helpMessage :: String
Config._helpMessage = String
"Enables the query field in http-logs for metadata queries (default: false)"
    }

-- TODO(SOLOMON): The defaulting behavior for this occurs inside the Engine. In
-- an isolated PR we should move that defaulting in the parsing stage.
parseDefaultNamingConvention :: Opt.Parser (Maybe NamingCase)
parseDefaultNamingConvention :: Parser (Maybe NamingCase)
parseDefaultNamingConvention =
  Parser NamingCase -> Parser (Maybe NamingCase)
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
Opt.optional (Parser NamingCase -> Parser (Maybe NamingCase))
-> Parser NamingCase -> Parser (Maybe NamingCase)
forall a b. (a -> b) -> a -> b
$
    ReadM NamingCase
-> Mod OptionFields NamingCase -> Parser NamingCase
forall a. ReadM a -> Mod OptionFields a -> Parser a
Opt.option
      ((String -> Either String NamingCase) -> ReadM NamingCase
forall a. (String -> Either String a) -> ReadM a
Opt.eitherReader String -> Either String NamingCase
forall a. FromEnv a => String -> Either String a
Env.fromEnv)
      ( String -> Mod OptionFields NamingCase
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"default-naming-convention"
          Mod OptionFields NamingCase
-> Mod OptionFields NamingCase -> Mod OptionFields NamingCase
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields NamingCase
forall (f :: * -> *) a. String -> Mod f a
Opt.help (Option () -> String
forall def. Option def -> String
Config._helpMessage Option ()
defaultNamingConventionOption)
      )

-- NOTE: This should be 'Config.Option NC.NamingCase' with a default
--of 'NC.HasuraCase' but 'ServeOptions' expects a 'Maybe
--NC.NamingCase' and HGE handles the defaulting explicitly. This
--should be changed in a subsequent PR.
defaultNamingConventionOption :: Config.Option ()
defaultNamingConventionOption :: Option ()
defaultNamingConventionOption =
  Option :: forall def. def -> String -> String -> Option def
Config.Option
    { _default :: ()
Config._default = (),
      _envVar :: String
Config._envVar = String
"HASURA_GRAPHQL_DEFAULT_NAMING_CONVENTION",
      _helpMessage :: String
Config._helpMessage =
        String
"Default naming convention for the auto generated graphql names. Possible values are"
          String -> String -> String
forall a. Semigroup a => a -> a -> a
<> String
"hasura-default: Use snake_case for all names."
          String -> String -> String
forall a. Semigroup a => a -> a -> a
<> String
"graphql-default: Use camelCase for field names and PascalCase for type names."
    }

parseExtensionsSchema :: Opt.Parser (Maybe MonadTx.ExtensionsSchema)
parseExtensionsSchema :: Parser (Maybe ExtensionsSchema)
parseExtensionsSchema =
  Parser ExtensionsSchema -> Parser (Maybe ExtensionsSchema)
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
Opt.optional (Parser ExtensionsSchema -> Parser (Maybe ExtensionsSchema))
-> Parser ExtensionsSchema -> Parser (Maybe ExtensionsSchema)
forall a b. (a -> b) -> a -> b
$
    ReadM ExtensionsSchema
-> Mod OptionFields ExtensionsSchema -> Parser ExtensionsSchema
forall a. ReadM a -> Mod OptionFields a -> Parser a
Opt.option
      ((String -> Either String ExtensionsSchema)
-> ReadM ExtensionsSchema
forall a. (String -> Either String a) -> ReadM a
Opt.eitherReader String -> Either String ExtensionsSchema
forall a. FromEnv a => String -> Either String a
Env.fromEnv)
      ( String -> Mod OptionFields ExtensionsSchema
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"metadata-database-extensions-schema"
          Mod OptionFields ExtensionsSchema
-> Mod OptionFields ExtensionsSchema
-> Mod OptionFields ExtensionsSchema
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields ExtensionsSchema
forall (f :: * -> *) a. String -> Mod f a
Opt.help (Option ExtensionsSchema -> String
forall def. Option def -> String
Config._helpMessage Option ExtensionsSchema
metadataDBExtensionsSchemaOption)
      )

metadataDBExtensionsSchemaOption :: Config.Option MonadTx.ExtensionsSchema
metadataDBExtensionsSchemaOption :: Option ExtensionsSchema
metadataDBExtensionsSchemaOption =
  Option :: forall def. def -> String -> String -> Option def
Config.Option
    { _default :: ExtensionsSchema
Config._default = Text -> ExtensionsSchema
MonadTx.ExtensionsSchema Text
"public",
      _envVar :: String
Config._envVar = String
"HASURA_GRAPHQL_METADATA_DATABASE_EXTENSIONS_SCHEMA",
      _helpMessage :: String
Config._helpMessage =
        String
"Name of the schema where Hasura can install database extensions. Default: public"
    }

--------------------------------------------------------------------------------
-- Pretty Printer

serveCmdFooter :: PP.Doc
serveCmdFooter :: Doc
serveCmdFooter =
  Doc
examplesDoc Doc -> Doc -> Doc
PP.<$> String -> Doc
PP.text String
"" Doc -> Doc -> Doc
PP.<$> Doc
envVarDoc
  where
    examplesDoc :: Doc
examplesDoc = [[String]] -> Doc
PP.mkExamplesDoc [[String]]
examples
    examples :: [[String]]
examples =
      [ [ String
"# Start GraphQL Engine on default port (8080) with console enabled",
          String
"graphql-engine --database-url <database-url> serve --enable-console"
        ],
        [ String
"# Start GraphQL Engine on default port (8080) with console disabled",
          String
"graphql-engine --database-url <database-url> serve"
        ],
        [ String
"# Start GraphQL Engine on a different port (say 9090) with console disabled",
          String
"graphql-engine --database-url <database-url> serve --server-port 9090"
        ],
        [ String
"# Start GraphQL Engine with admin secret key",
          String
"graphql-engine --database-url <database-url> serve --admin-secret <adminsecretkey>"
        ],
        [ String
"# Start GraphQL Engine with restrictive CORS policy (only allow https://example.com:8080)",
          String
"graphql-engine --database-url <database-url> serve --cors-domain https://example.com:8080"
        ],
        [ String
"# Start GraphQL Engine with multiple domains for CORS (https://example.com, http://localhost:3000 and https://*.foo.bar.com)",
          String
"graphql-engine --database-url <database-url> serve --cors-domain \"https://example.com, https://*.foo.bar.com, http://localhost:3000\""
        ],
        [ String
"# Start GraphQL Engine with Authentication Webhook (GET)",
          String
"graphql-engine --database-url <database-url> serve --admin-secret <adminsecretkey>"
            String -> String -> String
forall a. Semigroup a => a -> a -> a
<> String
" --auth-hook https://mywebhook.com/get"
        ],
        [ String
"# Start GraphQL Engine with Authentication Webhook (POST)",
          String
"graphql-engine --database-url <database-url> serve --admin-secret <adminsecretkey>"
            String -> String -> String
forall a. Semigroup a => a -> a -> a
<> String
" --auth-hook https://mywebhook.com/post --auth-hook-mode POST"
        ],
        [ String
"# Start GraphQL Engine with telemetry enabled/disabled",
          String
"graphql-engine --database-url <database-url> serve --enable-telemetry true|false"
        ],
        [ String
"# Start GraphQL Engine with HTTP compression enabled for '/v1/query' and '/v1/graphql' endpoints",
          String
"graphql-engine --database-url <database-url> serve --enable-compression"
        ],
        [ String
"# Start GraphQL Engine with enable/disable including 'internal' information in an error response for the request made by an 'admin'",
          String
"graphql-engine --database-url <database-url> serve --admin-internal-errors true|false"
        ]
      ]

    envVarDoc :: Doc
envVarDoc = [(String, String)] -> Doc
PP.mkEnvVarDoc ([(String, String)] -> Doc) -> [(String, String)] -> Doc
forall a b. (a -> b) -> a -> b
$ [(String, String)]
envVars [(String, String)] -> [(String, String)] -> [(String, String)]
forall a. Semigroup a => a -> a -> a
<> [(String, String)]
eventEnvs
    envVars :: [(String, String)]
envVars =
      [ Option Port -> (String, String)
forall a. Option a -> (String, String)
Config.optionPP Option Port
servePortOption,
        Option HostPreference -> (String, String)
forall a. Option a -> (String, String)
Config.optionPP Option HostPreference
serveHostOption,
        Option NonNegativeInt -> (String, String)
forall a. Option a -> (String, String)
Config.optionPP Option NonNegativeInt
pgStripesOption,
        Option NonNegativeInt -> (String, String)
forall a. Option a -> (String, String)
Config.optionPP Option NonNegativeInt
pgConnsOption,
        Option NonNegativeInt -> (String, String)
forall a. Option a -> (String, String)
Config.optionPP Option NonNegativeInt
pgTimeoutOption,
        Option (NonNegative NominalDiffTime) -> (String, String)
forall a. Option a -> (String, String)
Config.optionPP Option (NonNegative NominalDiffTime)
pgConnLifetimeOption,
        Option Bool -> (String, String)
forall a. Option a -> (String, String)
Config.optionPP Option Bool
pgUsePreparedStatementsOption,
        Option () -> (String, String)
forall a. Option a -> (String, String)
Config.optionPP Option ()
pgPoolTimeoutOption,
        Option TxIsolation -> (String, String)
forall a. Option a -> (String, String)
Config.optionPP Option TxIsolation
txIsolationOption,
        Option () -> (String, String)
forall a. Option a -> (String, String)
Config.optionPP Option ()
adminSecretOption,
        Option () -> (String, String)
forall a. Option a -> (String, String)
Config.optionPP Option ()
accessKeyOption,
        Option () -> (String, String)
forall a. Option a -> (String, String)
Config.optionPP Option ()
authHookOption,
        Option AuthHookType -> (String, String)
forall a. Option a -> (String, String)
Config.optionPP Option AuthHookType
authHookModeOption,
        Option () -> (String, String)
forall a. Option a -> (String, String)
Config.optionPP Option ()
jwtSecretOption,
        Option () -> (String, String)
forall a. Option a -> (String, String)
Config.optionPP Option ()
unAuthRoleOption,
        Option CorsConfig -> (String, String)
forall a. Option a -> (String, String)
Config.optionPP Option CorsConfig
corsDomainOption,
        Option Bool -> (String, String)
forall a. Option a -> (String, String)
Config.optionPP Option Bool
disableCorsOption,
        Option Bool -> (String, String)
forall a. Option a -> (String, String)
Config.optionPP Option Bool
enableConsoleOption,
        Option () -> (String, String)
forall a. Option a -> (String, String)
Config.optionPP Option ()
consoleAssetsDirOption,
        Option Bool -> (String, String)
forall a. Option a -> (String, String)
Config.optionPP Option Bool
enableTelemetryOption,
        Option Bool -> (String, String)
forall a. Option a -> (String, String)
Config.optionPP Option Bool
wsReadCookieOption,
        Option StringifyNumbers -> (String, String)
forall a. Option a -> (String, String)
Config.optionPP Option StringifyNumbers
stringifyNumOption,
        Option DangerouslyCollapseBooleans -> (String, String)
forall a. Option a -> (String, String)
Config.optionPP Option DangerouslyCollapseBooleans
dangerousBooleanCollapseOption,
        Option (HashSet API) -> (String, String)
forall a. Option a -> (String, String)
Config.optionPP Option (HashSet API)
enabledAPIsOption,
        Option RefetchInterval -> (String, String)
forall a. Option a -> (String, String)
Config.optionPP Option RefetchInterval
mxRefetchDelayOption,
        Option BatchSize -> (String, String)
forall a. Option a -> (String, String)
Config.optionPP Option BatchSize
mxBatchSizeOption,
        Option RefetchInterval -> (String, String)
forall a. Option a -> (String, String)
Config.optionPP Option RefetchInterval
streamingMxRefetchDelayOption,
        Option BatchSize -> (String, String)
forall a. Option a -> (String, String)
Config.optionPP Option BatchSize
streamingMxBatchSizeOption,
        Option Bool -> (String, String)
forall a. Option a -> (String, String)
Config.optionPP Option Bool
enableAllowlistOption,
        Option (HashSet (EngineLogType Hasura)) -> (String, String)
forall a. Option a -> (String, String)
Config.optionPP (EnabledLogTypes Hasura => Option (HashSet (EngineLogType Hasura))
forall impl.
EnabledLogTypes impl =>
Option (HashSet (EngineLogType impl))
enabledLogsOption @Logging.Hasura),
        Option LogLevel -> (String, String)
forall a. Option a -> (String, String)
Config.optionPP Option LogLevel
logLevelOption,
        Option Bool -> (String, String)
forall a. Option a -> (String, String)
Config.optionPP Option Bool
graphqlDevModeOption,
        Option Bool -> (String, String)
forall a. Option a -> (String, String)
Config.optionPP Option Bool
graphqlAdminInternalErrorsOption,
        Option PositiveInt -> (String, String)
forall a. Option a -> (String, String)
Config.optionPP Option PositiveInt
graphqlEventsHttpPoolSizeOption,
        Option (NonNegative Milliseconds) -> (String, String)
forall a. Option a -> (String, String)
Config.optionPP Option (NonNegative Milliseconds)
graphqlEventsFetchIntervalOption,
        Option OptionalInterval -> (String, String)
forall a. Option a -> (String, String)
Config.optionPP Option OptionalInterval
asyncActionsFetchIntervalOption,
        Option RemoteSchemaPermissions -> (String, String)
forall a. Option a -> (String, String)
Config.optionPP Option RemoteSchemaPermissions
enableRemoteSchemaPermsOption,
        Option Bool -> (String, String)
forall a. Option a -> (String, String)
Config.optionPP Option Bool
webSocketCompressionOption,
        Option KeepAliveDelay -> (String, String)
forall a. Option a -> (String, String)
Config.optionPP Option KeepAliveDelay
webSocketKeepAliveOption,
        Option InferFunctionPermissions -> (String, String)
forall a. Option a -> (String, String)
Config.optionPP Option InferFunctionPermissions
inferFunctionPermsOption,
        Option (MaintenanceMode ()) -> (String, String)
forall a. Option a -> (String, String)
Config.optionPP Option (MaintenanceMode ())
enableMaintenanceModeOption,
        Option OptionalInterval -> (String, String)
forall a. Option a -> (String, String)
Config.optionPP Option OptionalInterval
schemaPollIntervalOption,
        Option (HashSet ExperimentalFeature) -> (String, String)
forall a. Option a -> (String, String)
Config.optionPP Option (HashSet ExperimentalFeature)
experimentalFeaturesOption,
        Option NonNegativeInt -> (String, String)
forall a. Option a -> (String, String)
Config.optionPP Option NonNegativeInt
eventsFetchBatchSizeOption,
        Option (NonNegative Seconds) -> (String, String)
forall a. Option a -> (String, String)
Config.optionPP Option (NonNegative Seconds)
gracefulShutdownOption,
        Option WSConnectionInitTimeout -> (String, String)
forall a. Option a -> (String, String)
Config.optionPP Option WSConnectionInitTimeout
webSocketConnectionInitTimeoutOption,
        Option MetadataQueryLoggingMode -> (String, String)
forall a. Option a -> (String, String)
Config.optionPP Option MetadataQueryLoggingMode
enableMetadataQueryLoggingOption,
        Option () -> (String, String)
forall a. Option a -> (String, String)
Config.optionPP Option ()
defaultNamingConventionOption,
        Option ExtensionsSchema -> (String, String)
forall a. Option a -> (String, String)
Config.optionPP Option ExtensionsSchema
metadataDBExtensionsSchemaOption
      ]
    eventEnvs :: [(String, String)]
eventEnvs = [Option PositiveInt -> (String, String)
forall a. Option a -> (String, String)
Config.optionPP Option PositiveInt
graphqlEventsHttpPoolSizeOption, Option (NonNegative Milliseconds) -> (String, String)
forall a. Option a -> (String, String)
Config.optionPP Option (NonNegative Milliseconds)
graphqlEventsFetchIntervalOption]