Repository: hasura/graphql-engine
File: server/src-lib/Hasura/Server/Init/Config.hs (Haskell)

Code before:
  = ServeOptions
  { soPort                         :: !Int
  , soHost                         :: !HostPreference
  , soConnParams                   :: !Q.ConnParams
  , soTxIso                        :: !Q.TxIsolation
  , soAdminSecret                  :: !(Maybe AdminSecretHash)
  , soAuthHook                     :: !(Maybe AuthHook)
  , soJwtSecret                    :: !(Maybe JWTConfig)
  , soUnAuthRole                   :: !(Maybe RoleName)
  , soCorsConfig                   :: !CorsConfig
  , soEnableConsole                :: !Bool
  , soConsoleAssetsDir             :: !(Maybe Text)
  , soEnableTelemetry              :: !Bool
  , soStringifyNum                 :: !Bool
  , soEnabledAPIs                  :: !(Set.HashSet API)
  , soLiveQueryOpts                :: !LQ.LiveQueriesOptions
  , soEnableAllowlist              :: !Bool
  , soEnabledLogTypes              :: !(Set.HashSet (L.EngineLogType impl))
  , soLogLevel                     :: !L.LogLevel
  , soPlanCacheOptions             :: !E.PlanCacheOptions
  , soResponseInternalErrorsConfig :: !ResponseInternalErrorsConfig
  , soEventsHttpPoolSize           :: !(Maybe Int)
  , soEventsFetchInterval          :: !(Maybe Milliseconds)
  , soLogHeadersFromEnv            :: !Bool
  , soConnectionOptions            :: !WS.ConnectionOptions
  , soWebsocketKeepAlive           :: !(Maybe KeepAliveDelay)
  }

data DowngradeOptions
  = DowngradeOptions
  { dgoTargetVersion :: !Text
  , dgoDryRun        :: !Bool
  } deriving (Show, Eq)

data RawConnInfo =
  RawConnInfo
  { connHost     :: !(Maybe String)
  , connPort     :: !(Maybe Int)
  , connUser     :: !(Maybe String)
  , connPassword :: !String
  , connUrl      :: !(Maybe String)
  , connDatabase :: !(Maybe String)
  , connOptions  :: !(Maybe String)
  , connRetries  :: !(Maybe Int)
  } deriving (Eq, Read, Show)

data HGECommandG a
  = HCServe !a
  | HCExport
  | HCClean
  | HCExecute

Review comment (suggestion):
Because this value is contained in a `Maybe`, there is duplication of the default value: you have one default value specified in the definition of `webSocketKeepAlive`, and one in the definition of `defaultKeepAliveDelay`. If you make this line into
```suggestion
  , soWebsocketKeepAlive           :: !KeepAliveDelay
```
then this duplication should be avoidable. The type of `rsoWebSocketKeepAlive` can stay `Maybe`'d.

Code after:
  = ServeOptions
  { soPort                         :: !Int
  , soHost                         :: !HostPreference
  , soConnParams                   :: !Q.ConnParams
  , soTxIso                        :: !Q.TxIsolation
  , soAdminSecret                  :: !(Maybe AdminSecretHash)
  , soAuthHook                     :: !(Maybe AuthHook)
  , soJwtSecret                    :: !(Maybe JWTConfig)
  , soUnAuthRole                   :: !(Maybe RoleName)
  , soCorsConfig                   :: !CorsConfig
  , soEnableConsole                :: !Bool
  , soConsoleAssetsDir             :: !(Maybe Text)
  , soEnableTelemetry              :: !Bool
  , soStringifyNum                 :: !Bool
  , soEnabledAPIs                  :: !(Set.HashSet API)
  , soLiveQueryOpts                :: !LQ.LiveQueriesOptions
  , soEnableAllowlist              :: !Bool
  , soEnabledLogTypes              :: !(Set.HashSet (L.EngineLogType impl))
  , soLogLevel                     :: !L.LogLevel
  , soPlanCacheOptions             :: !E.PlanCacheOptions
  , soResponseInternalErrorsConfig :: !ResponseInternalErrorsConfig
  , soEventsHttpPoolSize           :: !(Maybe Int)
  , soEventsFetchInterval          :: !(Maybe Milliseconds)
  , soLogHeadersFromEnv            :: !Bool
  , soConnectionOptions            :: !WS.ConnectionOptions
  , soWebsocketKeepAlive           :: !KeepAliveDelay
  }

data DowngradeOptions
  = DowngradeOptions
  { dgoTargetVersion :: !Text
  , dgoDryRun        :: !Bool
  } deriving (Show, Eq)

data RawConnInfo =
  RawConnInfo
  { connHost     :: !(Maybe String)
  , connPort     :: !(Maybe Int)
  , connUser     :: !(Maybe String)
  , connPassword :: !String
  , connUrl      :: !(Maybe String)
  , connDatabase :: !(Maybe String)
  , connOptions  :: !(Maybe String)
  , connRetries  :: !(Maybe Int)
  } deriving (Eq, Read, Show)

data HGECommandG a
  = HCServe !a
  | HCExport
  | HCClean
  | HCExecute