Data type representing the configuration of a logging target
Constructors
ConfigNoLogno logging
ConfigFileLog FilePathlog to text file
ConfigIoLog (ByteString -> IO ())log custom IO handler
:: a typeCtrl KGHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05
Modulesnap-server-1.1.2.1Haskell2010
This module exports the Config datatype, which you can use to configure the Snap HTTP server.
Data type representing the configuration of a logging target
ConfigNoLogno logging
ConfigFileLog FilePathlog to text file
ConfigIoLog (ByteString -> IO ())log custom IO handler
A record type which represents partial configurations (for httpServe)
by wrapping all of its fields in a Maybe. Values of this type are usually
constructed via its Monoid instance by doing something like:
setPort 1234 memptyAny fields which are unspecified in the Config passed to httpServe (and
this is the norm) are filled in with default values from defaultConfig.
Confighostname :: Maybe ByteStringaccessLog :: Maybe ConfigLogerrorLog :: Maybe ConfigLoglocale :: Maybe Stringport :: Maybe Intbind :: Maybe ByteStringsslport :: Maybe Intsslbind :: Maybe ByteStringsslcert :: Maybe FilePathsslchaincert :: Maybe Boolsslkey :: Maybe FilePathunixsocket :: Maybe FilePathunixaccessmode :: Maybe Intcompression :: Maybe Boolverbose :: Maybe BoolerrorHandler :: Maybe (SomeException -> m ())defaultTimeout :: Maybe Intother :: Maybe aproxyType :: Maybe ProxyTypestartupHook :: Maybe (StartupInfo m a -> IO ())FIXME
Note: this type changed in snap-server 1.0.0.0.
These are the default values for the options
commandLineConfig :: MonadSnap m=> Config m adefault configuration. This is combined with defaultConfig to obtain default values to use if the given parameter is specified on the command line. Usually it is fine to use emptyConfig here.
-> IO (Config m a)extendedCommandLineConfig :: MonadSnap m=> [OptDescr (Maybe (Config m a))]Full list of command line options (combine yours with optDescrs to extend Snap's default set of options)
-> (a -> a -> a)State for multiple invoked user command-line options will be combined using this function.
-> Config m adefault configuration. This is combined with Snap's defaultConfig to obtain default values to use if the given parameter is specified on the command line. Usually it is fine to use emptyConfig here.
-> IO (Config m a)Returns a Config obtained from parsing command-line options, using the default Snap OptDescr set as well as a list of user OptDescrs. User OptDescrs use the "other" field (accessible using getOther and setOther) to store additional command-line option state. These are combined using a user-defined combining function.
On Unix systems, the locale is read from the LANG environment variable.
optDescrs Returns a description of the snap command line options suitable for use with System.Console.GetOpt.
Path to the access log
Returns the address to bind to (for http)
If set and set to True, compression is turned on when applicable
A MonadSnap action to handle 500 errors
Path to the error log
The hostname of the HTTP server. This field has the same format as an HTTP
Host header; if a Host header came in with the request, we use that,
otherwise we default to this value specified in the configuration.
Gets the locale to use. Locales are used on Unix only, to set the
LANG/LC_ALL/etc. environment variable. For instance if you set the
locale to "en_US", we'll set the relevant environment variables to
"en_US.UTF-8".
Returns the port to listen on (for http)
Returns the address to bind to (for https)
Path to the SSL certificate file
Path to the SSL certificate file
Path to the SSL key file
Returns the port to listen on (for https)
Whether to write server status updates to stderr
A startup hook is run after the server initializes but before user request processing begins. The server passes, through a StartupInfo object, the startup hook a list of the sockets it is listening on and the final Config object completed after command-line processing.
File path to unix socket. Must be absolute path, but allows for symbolic links.
Access mode for unix socket, by default is system specific. This should only be used to grant additional permissions to created socket file, and not to remove permissions set by default. The only portable way to limit access to socket is creating it in a directory with proper permissions set.
Most BSD systems ignore access permissions on unix sockets.
Note: This uses umask. There is a race condition if process creates other files at the same time as opening a unix socket with this option set.
Arguments passed to setStartupHook.