Safe Haskell | None |
---|
IHP.FrameworkConfig
Synopsis
- newtype AppHostname = AppHostname Text
- newtype AppPort = AppPort Int
- newtype BaseUrl = BaseUrl Text
- newtype RequestLoggerMiddleware = RequestLoggerMiddleware Middleware
- newtype SessionCookie = SessionCookie SetCookie
- newtype DBPoolIdleTime = DBPoolIdleTime NominalDiffTime
- newtype DBPoolMaxConnections = DBPoolMaxConnections Int
- newtype DatabaseUrl = DatabaseUrl ByteString
- type ConfigBuilder = StateT TMap IO ()
- newtype ExceptionTracker = ExceptionTracker {
- onException :: Maybe Request -> SomeException -> IO ()
- option :: forall option. Typeable option => option -> StateT TMap IO ()
- ihpDefaultConfig :: ConfigBuilder
- findOption :: forall option. Typeable option => StateT TMap IO option
- buildFrameworkConfig :: ConfigBuilder -> IO FrameworkConfig
- data FrameworkConfig = FrameworkConfig {
- appHostname :: !Text
- environment :: !Environment
- appPort :: !Int
- baseUrl :: !Text
- requestLoggerMiddleware :: !Middleware
- sessionCookie :: !SetCookie
- mailServer :: !MailServer
- databaseUrl :: !ByteString
- dbPoolIdleTime :: !NominalDiffTime
- dbPoolMaxConnections :: !Int
- cssFramework :: !CSSFramework
- logger :: !Logger
- exceptionTracker :: !ExceptionTracker
- class ConfigProvider a where
- getFrameworkConfig :: a -> FrameworkConfig
- fromConfig :: (?context :: context, ConfigProvider context) => (FrameworkConfig -> a) -> a
- getConfig :: (?context :: context, ConfigProvider context) => FrameworkConfig
- defaultIHPSessionCookie :: Text -> SetCookie
- data RootApplication = RootApplication
- defaultPort :: Int
- defaultAppPort :: IO Int
- defaultDatabaseUrl :: IO ByteString
- defaultLoggerForEnv :: Environment -> IO Logger
- isEnvironment :: (?context :: context, ConfigProvider context) => Environment -> Bool
- isDevelopment :: (?context :: context, ConfigProvider context) => Bool
- isProduction :: (?context :: context, ConfigProvider context) => Bool
Documentation
newtype AppHostname Source #
Constructors
AppHostname Text |
newtype RequestLoggerMiddleware Source #
Provides IHP with a middleware to log requests and responses.
By default this uses the RequestLogger middleware from wai-extra. Take a look at the wai-extra documentation when you want to customize the request logging.
Set requestLoggerMiddleware = application -> application
to disable request logging.
Constructors
RequestLoggerMiddleware Middleware |
newtype SessionCookie Source #
Provides the default settings for the session cookie.
- Max Age: 30 days
- Same Site Policy: Lax
- HttpOnly (no access through JS)
- secure, when baseUrl is a https url
Override this to set e.g. a custom max age or change the default same site policy.
Example: Set max age to 90 days > sessionCookie = defaultIHPSessionCookie { Cookie.setCookieMaxAge = Just (fromIntegral (60 * 60 * 24 * 90)) }
Constructors
SessionCookie SetCookie |
newtype DBPoolIdleTime Source #
How long db connection are kept alive inside the connecton pool when they're idle
Constructors
DBPoolIdleTime NominalDiffTime |
newtype DBPoolMaxConnections Source #
Max number of db connections the connection pool can open to the database
Constructors
DBPoolMaxConnections Int |
newtype DatabaseUrl Source #
Constructors
DatabaseUrl ByteString |
type ConfigBuilder = StateT TMap IO () Source #
newtype ExceptionTracker Source #
Interface for exception tracking services such as sentry
Constructors
ExceptionTracker | |
Fields
|
option :: forall option. Typeable option => option -> StateT TMap IO () Source #
Puts an option into the current configuration
In case an option already exists with the same type, it will not be overriden:
option Production option Development findOption @Environment
This code will return Production
as the second call to option
is ignored to not override the existing option.
data FrameworkConfig Source #
Constructors
FrameworkConfig | |
Fields
|
Instances
LoggingProvider FrameworkConfig Source # | |
Defined in IHP.FrameworkConfig Methods getLogger :: FrameworkConfig -> Logger Source # | |
ConfigProvider FrameworkConfig Source # | |
Defined in IHP.FrameworkConfig Methods getFrameworkConfig :: FrameworkConfig -> FrameworkConfig Source # |
class ConfigProvider a where Source #
Methods
getFrameworkConfig :: a -> FrameworkConfig Source #
Instances
HasField "requestContext" viewContext RequestContext => ConfigProvider viewContext Source # | |
Defined in IHP.ViewSupport Methods getFrameworkConfig :: viewContext -> FrameworkConfig Source # | |
ConfigProvider FrameworkConfig Source # | |
Defined in IHP.FrameworkConfig Methods getFrameworkConfig :: FrameworkConfig -> FrameworkConfig Source # | |
ConfigProvider RequestContext Source # | |
Defined in IHP.Controller.RequestContext Methods getFrameworkConfig :: RequestContext -> FrameworkConfig Source # | |
ConfigProvider ControllerContext Source # | |
Defined in IHP.Controller.Context Methods getFrameworkConfig :: ControllerContext -> FrameworkConfig Source # |
fromConfig :: (?context :: context, ConfigProvider context) => (FrameworkConfig -> a) -> a Source #
Proxies FrameworkConfig fields contained in some context that can provider a FrameworkConfig
getConfig :: (?context :: context, ConfigProvider context) => FrameworkConfig Source #
Get the current frameworkConfig
defaultIHPSessionCookie :: Text -> SetCookie Source #
Returns the default IHP session cookie configuration. Useful when you want to override the default settings in $sel:sessionCookie:FrameworkConfig
data RootApplication Source #
Constructors
RootApplication |
Instances
Eq RootApplication Source # | |
Defined in IHP.FrameworkConfig Methods (==) :: RootApplication -> RootApplication -> Bool # (/=) :: RootApplication -> RootApplication -> Bool # | |
Show RootApplication Source # | |
Defined in IHP.FrameworkConfig Methods showsPrec :: Int -> RootApplication -> ShowS # show :: RootApplication -> String showList :: [RootApplication] -> ShowS # |
defaultPort :: Int Source #
defaultAppPort :: IO Int Source #
isEnvironment :: (?context :: context, ConfigProvider context) => Environment -> Bool Source #
isDevelopment :: (?context :: context, ConfigProvider context) => Bool Source #
Returns True
when the application is running in Development mode
Development mode means that the Development option is configured in Config/Config.hs
isProduction :: (?context :: context, ConfigProvider context) => Bool Source #
Returns True
when the application is running in Production mode
Production mode means that the Production option is configured in Config/Config.hs