really fix the app port

was missing in appRoot
This commit is contained in:
Greg Weber 2011-08-17 08:43:31 -07:00
parent 1424c53603
commit b91000e756
4 changed files with 16 additions and 17 deletions

View File

@ -119,8 +119,8 @@ scaffold = do
Tiny -> ""
settingsTextImport = case backend of
Postgresql -> "import Data.Text (Text, concat)"
_ -> "import Data.Text"
Postgresql -> "import Data.Text (Text, pack, concat)\nimport Prelude hiding (concat)"
_ -> "import Data.Text (Text, pack)"
packages = if backend == MongoDB then ", mongoDB\n , bson\n" else ""

View File

@ -34,7 +34,6 @@ import Database.Persist.~importPersist~
import Yesod (liftIO, MonadControlIO, addWidget, addCassius, addJulius, addLucius, whamletFile)
import Data.Monoid (mempty)
import System.Directory (doesFileExist)
import Prelude hiding (concat)
~settingsTextImport~
import Data.Object
import qualified Data.Object.Yaml as YAML
@ -86,14 +85,14 @@ loadConfig :: AppEnvironment -> IO AppConfig
loadConfig env = do
allSettings <- (join $ YAML.decodeFile ("config/settings.yml" :: String)) >>= fromMapping
settings <- lookupMapping (show env) allSettings
appPortS <- lookupScalar "appPort" settings
appRootS <- lookupScalar "appRoot" settings
portS <- lookupScalar "port" settings
hostS <- lookupScalar "host" settings
connectionPoolSizeS <- lookupScalar "connectionPoolSize" settings
return $ AppConfig {
appEnv = env
, appPort = read $ appPortS
, appRoot = read $ (show appRootS)
, connectionPoolSize = read $ connectionPoolSizeS
, appPort = read portS
, appRoot = pack (hostS ++ ":" ++ portS)
, connectionPoolSize = read connectionPoolSizeS
}
-- Static setting below. Changing these requires a recompile
@ -117,7 +116,7 @@ staticDir = "static"
--
-- To see how this value is used, see urlRenderOverride in ~sitearg~.hs
staticRoot :: AppConfig -> Text
staticRoot conf = [st|#{appRoot conf}:#{show $ appPort conf}/static|]
staticRoot conf = [st|#{appRoot conf}/static|]
-- The rest of this file contains settings which rarely need changing by a

View File

@ -1,6 +1,6 @@
Default: &defaults
appRoot: "http://localhost"
appPort: 3000
host: "http://localhost"
port: 3000
connectionPoolSize: 10
Development:

View File

@ -29,7 +29,7 @@ import Language.Haskell.TH.Syntax
import Yesod.Widget (addWidget, addCassius, addJulius, addLucius, whamletFile)
import Data.Monoid (mempty)
import System.Directory (doesFileExist)
import Data.Text (Text)
~settingsTextImport~
import Data.Object
import qualified Data.Object.Yaml as YAML
import Control.Monad (join)
@ -67,12 +67,12 @@ loadConfig :: AppEnvironment -> IO AppConfig
loadConfig env = do
allSettings <- (join $ YAML.decodeFile ("config/settings.yml" :: String)) >>= fromMapping
settings <- lookupMapping (show env) allSettings
appPortS <- lookupScalar "appPort" settings
appRootS <- lookupScalar "appRoot" settings
portS <- lookupScalar "port" settings
hostS <- lookupScalar "host" settings
return $ AppConfig {
appEnv = env
, appPort = read $ appPortS
, appRoot = read $ (show appRootS)
, appPort = read portS
, appRoot = pack (hostS ++ ":" ++ portS)
}
-- | The location of static files on your system. This is a file system
@ -94,7 +94,7 @@ staticDir = "static"
--
-- To see how this value is used, see urlRenderOverride in ~project~.hs
staticRoot :: AppConfig -> Text
staticRoot conf = [st|#{appRoot conf}:#{show $ appPort conf}/static|]
staticRoot conf = [st|#{appRoot conf}/static|]
-- The rest of this file contains settings which rarely need changing by a
-- user.