now capable of multiple domain names

This commit is contained in:
nek0 2015-04-02 07:03:38 +02:00
parent 5c61f1a128
commit e1f2ae00be
2 changed files with 11 additions and 1 deletions

View file

@ -30,6 +30,8 @@ import Text.Hamlet (hamletFile)
import Yesod.Core.Types import Yesod.Core.Types
-- costom imports -- costom imports
import Data.Text import Data.Text
import Data.Text.Encoding
import Network.Wai
import Helper import Helper
-- | The site argument for your application. This can be a good place to -- | The site argument for your application. This can be a good place to
@ -110,10 +112,17 @@ formLayout :: Widget -> Handler Html
formLayout widget = do formLayout widget = do
renderLayout $(widgetFile "form-widget") renderLayout $(widgetFile "form-widget")
approotRequest :: App -> Request -> Text
approotRequest master req =
case requestHeaderHost req of
Just a -> decodeUtf8 a
Nothing -> appRoot $ appSettings master
-- Please see the documentation for the Yesod typeclass. There are a number -- Please see the documentation for the Yesod typeclass. There are a number
-- of settings which can be configured by overriding methods here. -- of settings which can be configured by overriding methods here.
instance Yesod App where instance Yesod App where
approot = ApprootMaster $ appRoot . appSettings --approot = ApprootMaster $ appRoot . appSettings
approot = ApprootRequest approotRequest
-- change maximum content length -- change maximum content length
maximumContentLength _ _ = Just $ 1024 ^ (5 :: Int) maximumContentLength _ _ = Just $ 1024 ^ (5 :: Int)

View file

@ -115,6 +115,7 @@ library
, blaze-builder , blaze-builder
, blaze-markup , blaze-markup
, either , either
, wai
executable eidolon executable eidolon
if flag(library-only) if flag(library-only)