really fix the app port
was missing in appRoot
This commit is contained in:
parent
1424c53603
commit
b91000e756
@ -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 ""
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
Default: &defaults
|
||||
appRoot: "http://localhost"
|
||||
appPort: 3000
|
||||
host: "http://localhost"
|
||||
port: 3000
|
||||
connectionPoolSize: 10
|
||||
|
||||
Development:
|
||||
|
||||
@ -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.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user