snap-server-0.5.4: A fast, iteratee-based, epoll-enabled web server for the Snap Framework

Snap.Http.Server.Config

Description

This module exports the Config datatype, which you can use to configure the Snap HTTP server.

Synopsis

Documentation

data Config m a Source

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 mempty

Any fields which are unspecified in the Config passed to httpServe (and this is the norm) are filled in with default values from defaultConfig.

Instances

Show (Config m a) 
Monoid (Config m a) 

data ConfigBackend Source

This datatype allows you to override which backend (either simple or libev) to use. Most users will not want to set this, preferring to rely on the compile-type default.

Note that if you specify the libev backend and have not compiled in support for it, your server will fail at runtime.

emptyConfig :: Config m aSource

Returns a completely empty Config. Equivalent to mempty from Config's Monoid instance.

defaultConfig :: MonadSnap m => Config m aSource

These are the default values for the options

commandLineConfigSource

Arguments

:: MonadSnap m 
=> Config m a

default configuration. This is combined with defaultConfig to obtain default values to use if the given parameter is not specified on the command line. Usually it is fine to use emptyConfig here.

-> IO (Config m a) 

Returns a Config obtained from parsing the options specified on the command-line.

On Unix systems, the locale is read from the LANG environment variable.

getAccessLog :: Config m a -> Maybe (Maybe FilePath)Source

Path to the access log

getBind :: Config m a -> Maybe ByteStringSource

Returns the address to bind to (for http)

getCompression :: Config m a -> Maybe BoolSource

If set and set to True, compression is turned on when applicable

getErrorHandler :: Config m a -> Maybe (SomeException -> m ())Source

A MonadSnap action to handle 500 errors

getErrorLog :: Config m a -> Maybe (Maybe FilePath)Source

Path to the error log

getHostname :: Config m a -> Maybe ByteStringSource

The hostname of the HTTP server

getLocale :: Config m a -> Maybe StringSource

The locale to use

getPort :: Config m a -> Maybe IntSource

Returns the port to listen on (for http)

getSSLBind :: Config m a -> Maybe ByteStringSource

Returns the address to bind to (for https)

getSSLCert :: Config m a -> Maybe FilePathSource

Path to the SSL certificate file

getSSLKey :: Config m a -> Maybe FilePathSource

Path to the SSL key file

getSSLPort :: Config m a -> Maybe IntSource

Returns the port to listen on (for https)

getVerbose :: Config m a -> Maybe BoolSource

Whether to write server status updates to stderr

setOther :: a -> Config m a -> Config m aSource

setPort :: Int -> Config m a -> Config m aSource