{- |
Copyright: 2009, Henning Thielemann
-}
module Network.MoHWS.Configuration.Accessor where

import qualified Network.MoHWS.Configuration as Config
import qualified Data.Set as Set
import qualified Data.Accessor.Basic as Accessor

import qualified Network.MoHWS.Logger.Level as LogLevel
import Network.Socket (PortNumber, )

{-
(\w+)( *):: (.+)
\1 :: Accessor.T (Config.T ext) \3\n\1 =\n   Accessor.fromSetGet (\\x c -> c{Config.\1 = x}) Config.\1\n
-}

user :: Accessor.T (Config.T ext) String
user :: T (T ext) String
user =
   (String -> T ext -> T ext) -> (T ext -> String) -> T (T ext) String
forall a r. (a -> r -> r) -> (r -> a) -> T r a
Accessor.fromSetGet (\String
x T ext
c -> T ext
c{user :: String
Config.user = String
x}) T ext -> String
forall ext. T ext -> String
Config.user

group :: Accessor.T (Config.T ext) String
group :: T (T ext) String
group =
   (String -> T ext -> T ext) -> (T ext -> String) -> T (T ext) String
forall a r. (a -> r -> r) -> (r -> a) -> T r a
Accessor.fromSetGet (\String
x T ext
c -> T ext
c{group :: String
Config.group = String
x}) T ext -> String
forall ext. T ext -> String
Config.group


listen :: Accessor.T (Config.T ext) [(Maybe String, PortNumber)]
listen :: T (T ext) [(Maybe String, PortNumber)]
listen =
   ([(Maybe String, PortNumber)] -> T ext -> T ext)
-> (T ext -> [(Maybe String, PortNumber)])
-> T (T ext) [(Maybe String, PortNumber)]
forall a r. (a -> r -> r) -> (r -> a) -> T r a
Accessor.fromSetGet (\[(Maybe String, PortNumber)]
x T ext
c -> T ext
c{listen :: [(Maybe String, PortNumber)]
Config.listen = [(Maybe String, PortNumber)]
x}) T ext -> [(Maybe String, PortNumber)]
forall ext. T ext -> [(Maybe String, PortNumber)]
Config.listen


requestTimeout :: Accessor.T (Config.T ext) Int
requestTimeout :: T (T ext) Int
requestTimeout =
   (Int -> T ext -> T ext) -> (T ext -> Int) -> T (T ext) Int
forall a r. (a -> r -> r) -> (r -> a) -> T r a
Accessor.fromSetGet (\Int
x T ext
c -> T ext
c{requestTimeout :: Int
Config.requestTimeout = Int
x}) T ext -> Int
forall ext. T ext -> Int
Config.requestTimeout

keepAliveTimeout :: Accessor.T (Config.T ext) Int
keepAliveTimeout :: T (T ext) Int
keepAliveTimeout =
   (Int -> T ext -> T ext) -> (T ext -> Int) -> T (T ext) Int
forall a r. (a -> r -> r) -> (r -> a) -> T r a
Accessor.fromSetGet (\Int
x T ext
c -> T ext
c{keepAliveTimeout :: Int
Config.keepAliveTimeout = Int
x}) T ext -> Int
forall ext. T ext -> Int
Config.keepAliveTimeout

maxClients :: Accessor.T (Config.T ext) Int
maxClients :: T (T ext) Int
maxClients =
   (Int -> T ext -> T ext) -> (T ext -> Int) -> T (T ext) Int
forall a r. (a -> r -> r) -> (r -> a) -> T r a
Accessor.fromSetGet (\Int
x T ext
c -> T ext
c{maxClients :: Int
Config.maxClients = Int
x}) T ext -> Int
forall ext. T ext -> Int
Config.maxClients


serverAdmin :: Accessor.T (Config.T ext) String
serverAdmin :: T (T ext) String
serverAdmin =
   (String -> T ext -> T ext) -> (T ext -> String) -> T (T ext) String
forall a r. (a -> r -> r) -> (r -> a) -> T r a
Accessor.fromSetGet (\String
x T ext
c -> T ext
c{serverAdmin :: String
Config.serverAdmin = String
x}) T ext -> String
forall ext. T ext -> String
Config.serverAdmin

serverName :: Accessor.T (Config.T ext) String
serverName :: T (T ext) String
serverName =
   (String -> T ext -> T ext) -> (T ext -> String) -> T (T ext) String
forall a r. (a -> r -> r) -> (r -> a) -> T r a
Accessor.fromSetGet (\String
x T ext
c -> T ext
c{serverName :: String
Config.serverName = String
x}) T ext -> String
forall ext. T ext -> String
Config.serverName

serverAlias :: Accessor.T (Config.T ext) (Set.Set String)
serverAlias :: T (T ext) (Set String)
serverAlias =
   (Set String -> T ext -> T ext)
-> (T ext -> Set String) -> T (T ext) (Set String)
forall a r. (a -> r -> r) -> (r -> a) -> T r a
Accessor.fromSetGet (\Set String
x T ext
c -> T ext
c{serverAlias :: Set String
Config.serverAlias = Set String
x}) T ext -> Set String
forall ext. T ext -> Set String
Config.serverAlias

useCanonicalName :: Accessor.T (Config.T ext) Bool
useCanonicalName :: T (T ext) Bool
useCanonicalName =
   (Bool -> T ext -> T ext) -> (T ext -> Bool) -> T (T ext) Bool
forall a r. (a -> r -> r) -> (r -> a) -> T r a
Accessor.fromSetGet (\Bool
x T ext
c -> T ext
c{useCanonicalName :: Bool
Config.useCanonicalName = Bool
x}) T ext -> Bool
forall ext. T ext -> Bool
Config.useCanonicalName

hostnameLookups :: Accessor.T (Config.T ext) Bool
hostnameLookups :: T (T ext) Bool
hostnameLookups =
   (Bool -> T ext -> T ext) -> (T ext -> Bool) -> T (T ext) Bool
forall a r. (a -> r -> r) -> (r -> a) -> T r a
Accessor.fromSetGet (\Bool
x T ext
c -> T ext
c{hostnameLookups :: Bool
Config.hostnameLookups = Bool
x}) T ext -> Bool
forall ext. T ext -> Bool
Config.hostnameLookups


documentRoot :: Accessor.T (Config.T ext) FilePath
documentRoot :: T (T ext) String
documentRoot =
   (String -> T ext -> T ext) -> (T ext -> String) -> T (T ext) String
forall a r. (a -> r -> r) -> (r -> a) -> T r a
Accessor.fromSetGet (\String
x T ext
c -> T ext
c{documentRoot :: String
Config.documentRoot = String
x}) T ext -> String
forall ext. T ext -> String
Config.documentRoot

accessFileName :: Accessor.T (Config.T ext) FilePath
accessFileName :: T (T ext) String
accessFileName =
   (String -> T ext -> T ext) -> (T ext -> String) -> T (T ext) String
forall a r. (a -> r -> r) -> (r -> a) -> T r a
Accessor.fromSetGet (\String
x T ext
c -> T ext
c{accessFileName :: String
Config.accessFileName = String
x}) T ext -> String
forall ext. T ext -> String
Config.accessFileName

indexes :: Accessor.T (Config.T ext) Bool
indexes :: T (T ext) Bool
indexes =
   (Bool -> T ext -> T ext) -> (T ext -> Bool) -> T (T ext) Bool
forall a r. (a -> r -> r) -> (r -> a) -> T r a
Accessor.fromSetGet (\Bool
x T ext
c -> T ext
c{indexes :: Bool
Config.indexes = Bool
x}) T ext -> Bool
forall ext. T ext -> Bool
Config.indexes

followSymbolicLinks :: Accessor.T (Config.T ext) Bool
followSymbolicLinks :: T (T ext) Bool
followSymbolicLinks =
   (Bool -> T ext -> T ext) -> (T ext -> Bool) -> T (T ext) Bool
forall a r. (a -> r -> r) -> (r -> a) -> T r a
Accessor.fromSetGet (\Bool
x T ext
c -> T ext
c{followSymbolicLinks :: Bool
Config.followSymbolicLinks = Bool
x}) T ext -> Bool
forall ext. T ext -> Bool
Config.followSymbolicLinks

chunkSize :: Accessor.T (Config.T ext) Int
chunkSize :: T (T ext) Int
chunkSize =
   (Int -> T ext -> T ext) -> (T ext -> Int) -> T (T ext) Int
forall a r. (a -> r -> r) -> (r -> a) -> T r a
Accessor.fromSetGet (\Int
x T ext
c -> T ext
c{chunkSize :: Int
Config.chunkSize = Int
x}) T ext -> Int
forall ext. T ext -> Int
Config.chunkSize


typesConfig :: Accessor.T (Config.T ext) String
typesConfig :: T (T ext) String
typesConfig =
   (String -> T ext -> T ext) -> (T ext -> String) -> T (T ext) String
forall a r. (a -> r -> r) -> (r -> a) -> T r a
Accessor.fromSetGet (\String
x T ext
c -> T ext
c{typesConfig :: String
Config.typesConfig = String
x}) T ext -> String
forall ext. T ext -> String
Config.typesConfig

defaultType :: Accessor.T (Config.T ext) String
defaultType :: T (T ext) String
defaultType =
   (String -> T ext -> T ext) -> (T ext -> String) -> T (T ext) String
forall a r. (a -> r -> r) -> (r -> a) -> T r a
Accessor.fromSetGet (\String
x T ext
c -> T ext
c{defaultType :: String
Config.defaultType = String
x}) T ext -> String
forall ext. T ext -> String
Config.defaultType


addLanguage :: Accessor.T (Config.T ext) [(String,String)]
addLanguage :: T (T ext) [(String, String)]
addLanguage =
   ([(String, String)] -> T ext -> T ext)
-> (T ext -> [(String, String)]) -> T (T ext) [(String, String)]
forall a r. (a -> r -> r) -> (r -> a) -> T r a
Accessor.fromSetGet (\[(String, String)]
x T ext
c -> T ext
c{addLanguage :: [(String, String)]
Config.addLanguage = [(String, String)]
x}) T ext -> [(String, String)]
forall ext. T ext -> [(String, String)]
Config.addLanguage

languagePriority :: Accessor.T (Config.T ext) [String]
languagePriority :: T (T ext) [String]
languagePriority =
   ([String] -> T ext -> T ext)
-> (T ext -> [String]) -> T (T ext) [String]
forall a r. (a -> r -> r) -> (r -> a) -> T r a
Accessor.fromSetGet (\[String]
x T ext
c -> T ext
c{languagePriority :: [String]
Config.languagePriority = [String]
x}) T ext -> [String]
forall ext. T ext -> [String]
Config.languagePriority


customLogs :: Accessor.T (Config.T ext) [(FilePath, String)]
customLogs :: T (T ext) [(String, String)]
customLogs =
   ([(String, String)] -> T ext -> T ext)
-> (T ext -> [(String, String)]) -> T (T ext) [(String, String)]
forall a r. (a -> r -> r) -> (r -> a) -> T r a
Accessor.fromSetGet (\[(String, String)]
x T ext
c -> T ext
c{customLogs :: [(String, String)]
Config.customLogs = [(String, String)]
x}) T ext -> [(String, String)]
forall ext. T ext -> [(String, String)]
Config.customLogs


errorLogFile :: Accessor.T (Config.T ext) FilePath
errorLogFile :: T (T ext) String
errorLogFile =
   (String -> T ext -> T ext) -> (T ext -> String) -> T (T ext) String
forall a r. (a -> r -> r) -> (r -> a) -> T r a
Accessor.fromSetGet (\String
x T ext
c -> T ext
c{errorLogFile :: String
Config.errorLogFile = String
x}) T ext -> String
forall ext. T ext -> String
Config.errorLogFile

logLevel :: Accessor.T (Config.T ext) LogLevel.T
logLevel :: T (T ext) T
logLevel =
   (T -> T ext -> T ext) -> (T ext -> T) -> T (T ext) T
forall a r. (a -> r -> r) -> (r -> a) -> T r a
Accessor.fromSetGet (\T
x T ext
c -> T ext
c{logLevel :: T
Config.logLevel = T
x}) T ext -> T
forall ext. T ext -> T
Config.logLevel


extension :: Accessor.T (Config.T ext) ext
extension :: T (T ext) ext
extension =
   (ext -> T ext -> T ext) -> (T ext -> ext) -> T (T ext) ext
forall a r. (a -> r -> r) -> (r -> a) -> T r a
Accessor.fromSetGet (\ext
x T ext
c -> T ext
c{extension :: ext
Config.extension = ext
x}) T ext -> ext
forall ext. T ext -> ext
Config.extension