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 -> ""
|
Tiny -> ""
|
||||||
|
|
||||||
settingsTextImport = case backend of
|
settingsTextImport = case backend of
|
||||||
Postgresql -> "import Data.Text (Text, concat)"
|
Postgresql -> "import Data.Text (Text, pack, concat)\nimport Prelude hiding (concat)"
|
||||||
_ -> "import Data.Text"
|
_ -> "import Data.Text (Text, pack)"
|
||||||
|
|
||||||
packages = if backend == MongoDB then ", mongoDB\n , bson\n" else ""
|
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 Yesod (liftIO, MonadControlIO, addWidget, addCassius, addJulius, addLucius, whamletFile)
|
||||||
import Data.Monoid (mempty)
|
import Data.Monoid (mempty)
|
||||||
import System.Directory (doesFileExist)
|
import System.Directory (doesFileExist)
|
||||||
import Prelude hiding (concat)
|
|
||||||
~settingsTextImport~
|
~settingsTextImport~
|
||||||
import Data.Object
|
import Data.Object
|
||||||
import qualified Data.Object.Yaml as YAML
|
import qualified Data.Object.Yaml as YAML
|
||||||
@ -86,14 +85,14 @@ loadConfig :: AppEnvironment -> IO AppConfig
|
|||||||
loadConfig env = do
|
loadConfig env = do
|
||||||
allSettings <- (join $ YAML.decodeFile ("config/settings.yml" :: String)) >>= fromMapping
|
allSettings <- (join $ YAML.decodeFile ("config/settings.yml" :: String)) >>= fromMapping
|
||||||
settings <- lookupMapping (show env) allSettings
|
settings <- lookupMapping (show env) allSettings
|
||||||
appPortS <- lookupScalar "appPort" settings
|
portS <- lookupScalar "port" settings
|
||||||
appRootS <- lookupScalar "appRoot" settings
|
hostS <- lookupScalar "host" settings
|
||||||
connectionPoolSizeS <- lookupScalar "connectionPoolSize" settings
|
connectionPoolSizeS <- lookupScalar "connectionPoolSize" settings
|
||||||
return $ AppConfig {
|
return $ AppConfig {
|
||||||
appEnv = env
|
appEnv = env
|
||||||
, appPort = read $ appPortS
|
, appPort = read portS
|
||||||
, appRoot = read $ (show appRootS)
|
, appRoot = pack (hostS ++ ":" ++ portS)
|
||||||
, connectionPoolSize = read $ connectionPoolSizeS
|
, connectionPoolSize = read connectionPoolSizeS
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Static setting below. Changing these requires a recompile
|
-- 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
|
-- To see how this value is used, see urlRenderOverride in ~sitearg~.hs
|
||||||
staticRoot :: AppConfig -> Text
|
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
|
-- The rest of this file contains settings which rarely need changing by a
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
Default: &defaults
|
Default: &defaults
|
||||||
appRoot: "http://localhost"
|
host: "http://localhost"
|
||||||
appPort: 3000
|
port: 3000
|
||||||
connectionPoolSize: 10
|
connectionPoolSize: 10
|
||||||
|
|
||||||
Development:
|
Development:
|
||||||
|
|||||||
@ -29,7 +29,7 @@ import Language.Haskell.TH.Syntax
|
|||||||
import Yesod.Widget (addWidget, addCassius, addJulius, addLucius, whamletFile)
|
import Yesod.Widget (addWidget, addCassius, addJulius, addLucius, whamletFile)
|
||||||
import Data.Monoid (mempty)
|
import Data.Monoid (mempty)
|
||||||
import System.Directory (doesFileExist)
|
import System.Directory (doesFileExist)
|
||||||
import Data.Text (Text)
|
~settingsTextImport~
|
||||||
import Data.Object
|
import Data.Object
|
||||||
import qualified Data.Object.Yaml as YAML
|
import qualified Data.Object.Yaml as YAML
|
||||||
import Control.Monad (join)
|
import Control.Monad (join)
|
||||||
@ -67,12 +67,12 @@ loadConfig :: AppEnvironment -> IO AppConfig
|
|||||||
loadConfig env = do
|
loadConfig env = do
|
||||||
allSettings <- (join $ YAML.decodeFile ("config/settings.yml" :: String)) >>= fromMapping
|
allSettings <- (join $ YAML.decodeFile ("config/settings.yml" :: String)) >>= fromMapping
|
||||||
settings <- lookupMapping (show env) allSettings
|
settings <- lookupMapping (show env) allSettings
|
||||||
appPortS <- lookupScalar "appPort" settings
|
portS <- lookupScalar "port" settings
|
||||||
appRootS <- lookupScalar "appRoot" settings
|
hostS <- lookupScalar "host" settings
|
||||||
return $ AppConfig {
|
return $ AppConfig {
|
||||||
appEnv = env
|
appEnv = env
|
||||||
, appPort = read $ appPortS
|
, appPort = read portS
|
||||||
, appRoot = read $ (show appRootS)
|
, appRoot = pack (hostS ++ ":" ++ portS)
|
||||||
}
|
}
|
||||||
|
|
||||||
-- | The location of static files on your system. This is a file system
|
-- | 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
|
-- To see how this value is used, see urlRenderOverride in ~project~.hs
|
||||||
staticRoot :: AppConfig -> Text
|
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
|
-- The rest of this file contains settings which rarely need changing by a
|
||||||
-- user.
|
-- user.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user