| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
IHP.Environment
Synopsis
- data Environment
Documentation
data Environment Source #
The Environment type is used to switch between development and production configurations.
When running 'devenv up', this will be set to Development, while 'deploy-to-nixos' will set it to Production.
You can also manually set it with 'option Development' or 'option Production' in your Config.hs, or via the IHP_ENV environment variable.
You can check the current environment using isDevelopment, isProduction, or isEnvironment if you want to change behaviour based on the environment.
IHP by default implements the following differences:
- Static file caching: In
Development, browser cache is disabled (max-age=0). InProduction, max-age is forever, with asset hashes for invalidation. SeeinitStaticApp. - Logger: In
Development, logging uses the default format. InProduction, it uses an Apache-style logger and higher log level. SeeihpDefaultConfig. - Background workers: In
Development, a development job worker server is started automatically. InProduction, you need to manually start a separate RunJobs process. See the chapter on Jobs in the Guide for details. - Database connections: The pool idle time is by default shorter in
Development. SeeihpDefaultConfig. - Error pages: In
Development, error pages may contain backtraces and details about the code, with links to the IDE. InProduction, error pages do not contain implementation information.
Constructors
| Development | |
| Production |
Instances
| Show Environment Source # | |
Defined in IHP.Environment Methods showsPrec :: Int -> Environment -> ShowS # show :: Environment -> String # showList :: [Environment] -> ShowS # | |
| Eq Environment Source # | |
Defined in IHP.Environment | |
| EnvVarReader Environment Source # | |
Defined in IHP.EnvVar Methods envStringToValue :: ByteString -> Either Text Environment Source # | |