Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
3344dafe16
@ -35,15 +35,16 @@ import Data.Text (Text)
|
|||||||
-- | The base URL for your application. This will usually be different for
|
-- | The base URL for your application. This will usually be different for
|
||||||
-- development and production. Yesod automatically constructs URLs for you,
|
-- development and production. Yesod automatically constructs URLs for you,
|
||||||
-- so this value must be accurate to create valid links.
|
-- so this value must be accurate to create valid links.
|
||||||
|
-- Please note that there is no trailing slash.
|
||||||
approot :: Text
|
approot :: Text
|
||||||
|
approot =
|
||||||
#ifdef PRODUCTION
|
#ifdef PRODUCTION
|
||||||
-- You probably want to change this. If your domain name was "yesod.com",
|
-- You probably want to change this. If your domain name was "yesod.com",
|
||||||
-- you would probably want it to be:
|
-- you would probably want it to be:
|
||||||
-- > approot = "http://www.yesod.com"
|
-- > "http://yesod.com"
|
||||||
-- Please note that there is no trailing slash.
|
"http://localhost:3000"
|
||||||
approot = "http://localhost:3000"
|
|
||||||
#else
|
#else
|
||||||
approot = "http://localhost:3000"
|
"http://localhost:3000"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
-- | 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
|
||||||
@ -70,10 +71,11 @@ staticroot = approot `mappend` "/static"
|
|||||||
-- | The database connection string. The meaning of this string is backend-
|
-- | The database connection string. The meaning of this string is backend-
|
||||||
-- specific.
|
-- specific.
|
||||||
connStr :: Text
|
connStr :: Text
|
||||||
|
connStr =
|
||||||
#ifdef PRODUCTION
|
#ifdef PRODUCTION
|
||||||
connStr = "~connstr2~"
|
"~connstr2~"
|
||||||
#else
|
#else
|
||||||
connStr = "~connstr1~"
|
"~connstr1~"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
-- | Your application will keep a connection pool and take connections from
|
-- | Your application will keep a connection pool and take connections from
|
||||||
@ -106,42 +108,43 @@ connectionCount = 10
|
|||||||
-- used; to get the same auto-loading effect, it is recommended that you
|
-- used; to get the same auto-loading effect, it is recommended that you
|
||||||
-- use the devel server.
|
-- use the devel server.
|
||||||
|
|
||||||
toHamletFile, toCassiusFile, toJuliusFile, toLuciusFile :: String -> FilePath
|
-- | expects a root folder for each type, e.g: hamlet/ lucius/ julius/
|
||||||
toHamletFile x = "hamlet/" ++ x ++ ".hamlet"
|
globFile :: String -> String -> FilePath
|
||||||
toCassiusFile x = "cassius/" ++ x ++ ".cassius"
|
globFile kind x = kind ++ "/" ++ x ++ "." ++ kind
|
||||||
toJuliusFile x = "julius/" ++ x ++ ".julius"
|
|
||||||
toLuciusFile x = "lucius/" ++ x ++ ".lucius"
|
|
||||||
|
|
||||||
hamletFile :: FilePath -> Q Exp
|
hamletFile :: FilePath -> Q Exp
|
||||||
hamletFile = H.hamletFile . toHamletFile
|
hamletFile = H.hamletFile . globFile "hamlet"
|
||||||
|
|
||||||
cassiusFile :: FilePath -> Q Exp
|
cassiusFile :: FilePath -> Q Exp
|
||||||
|
cassiusFile =
|
||||||
#ifdef PRODUCTION
|
#ifdef PRODUCTION
|
||||||
cassiusFile = H.cassiusFile . toCassiusFile
|
H.cassiusFile . globFile "cassius"
|
||||||
#else
|
#else
|
||||||
cassiusFile = H.cassiusFileDebug . toCassiusFile
|
H.cassiusFileDebug . globFile "cassius"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
luciusFile :: FilePath -> Q Exp
|
luciusFile :: FilePath -> Q Exp
|
||||||
|
luciusFile =
|
||||||
#ifdef PRODUCTION
|
#ifdef PRODUCTION
|
||||||
luciusFile = H.luciusFile . toLuciusFile
|
H.luciusFile . globFile "lucius"
|
||||||
#else
|
#else
|
||||||
luciusFile = H.luciusFileDebug . toLuciusFile
|
H.luciusFileDebug . globFile "lucius"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
juliusFile :: FilePath -> Q Exp
|
juliusFile :: FilePath -> Q Exp
|
||||||
|
juliusFile =
|
||||||
#ifdef PRODUCTION
|
#ifdef PRODUCTION
|
||||||
juliusFile = H.juliusFile . toJuliusFile
|
H.juliusFile . globFile "julius"
|
||||||
#else
|
#else
|
||||||
juliusFile = H.juliusFileDebug . toJuliusFile
|
H.juliusFileDebug . globFile "julius"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
widgetFile :: FilePath -> Q Exp
|
widgetFile :: FilePath -> Q Exp
|
||||||
widgetFile x = do
|
widgetFile x = do
|
||||||
let h = unlessExists toHamletFile hamletFile
|
let h = unlessExists (globFile "hamlet") hamletFile
|
||||||
let c = unlessExists toCassiusFile cassiusFile
|
let c = unlessExists (globFile "cassius") cassiusFile
|
||||||
let j = unlessExists toJuliusFile juliusFile
|
let j = unlessExists (globFile "julius") juliusFile
|
||||||
let l = unlessExists toLuciusFile luciusFile
|
let l = unlessExists (globFile "lucius") luciusFile
|
||||||
[|addWidget $h >> addCassius $c >> addJulius $j >> addLucius $l|]
|
[|addWidget $h >> addCassius $c >> addJulius $j >> addLucius $l|]
|
||||||
where
|
where
|
||||||
unlessExists tofn f = do
|
unlessExists tofn f = do
|
||||||
@ -157,4 +160,3 @@ withConnectionPool = with~upper~Pool connStr connectionCount
|
|||||||
|
|
||||||
runConnectionPool :: MonadControlIO m => SqlPersist m a -> ConnectionPool -> m a
|
runConnectionPool :: MonadControlIO m => SqlPersist m a -> ConnectionPool -> m a
|
||||||
runConnectionPool = runSqlPool
|
runConnectionPool = runSqlPool
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user