remove old TODO
This commit is contained in:
parent
630124149a
commit
00cf9f2953
@ -60,9 +60,6 @@ defaultMain load withSite = do
|
||||
-- > Settings.withConnectionPool conf $ \p -> do
|
||||
-- > runConnectionPool (runMigration yourMigration) p
|
||||
-- > defaultRunner f $ YourSite conf logger p
|
||||
--
|
||||
-- TODO: ifdef WINDOWS
|
||||
--
|
||||
defaultRunner :: (YesodDispatch y y, Yesod y)
|
||||
=> (Application -> IO a)
|
||||
-> y -- ^ your foundation type
|
||||
|
||||
@ -6,7 +6,7 @@ module Application
|
||||
|
||||
import Import
|
||||
import Settings
|
||||
import Yesod.Static
|
||||
import Settings.StaticFiles (staticSite)
|
||||
import Yesod.Auth
|
||||
import Yesod.Default.Config
|
||||
import Yesod.Default.Main
|
||||
@ -29,11 +29,7 @@ mkYesodDispatch "~sitearg~" resources~sitearg~
|
||||
-- migrations handled by Yesod.
|
||||
with~sitearg~ :: AppConfig DefaultEnv () -> Logger -> (Application -> IO ()) -> IO ()
|
||||
with~sitearg~ conf logger f = do
|
||||
#ifdef DEVELOPMENT
|
||||
s <- staticDevel Settings.staticDir
|
||||
#else
|
||||
s <- static Settings.staticDir
|
||||
#endif
|
||||
s <- staticSite
|
||||
dbconf <- withYamlEnvironment "config/~dbConfigFile~.yml" (appEnv conf)
|
||||
$ either error return . Database.Persist.Base.loadConfig
|
||||
Database.Persist.Base.withPool (dbconf :: Settings.PersistConfig) $ \p -> do~runMigration~
|
||||
|
||||
@ -1,10 +1,21 @@
|
||||
module Settings.StaticFiles where
|
||||
|
||||
import Yesod.Static (staticFiles, StaticRoute (StaticRoute))
|
||||
import qualified Yesod.Static as Static
|
||||
import Settings (staticDir)
|
||||
|
||||
-- | This generates easy references to files in the static directory at compile time.
|
||||
-- The upside to this is that you have compile-time verification that referenced files
|
||||
-- exist. However, any files added to your static directory during run-time can't be
|
||||
-- | use this to create your static file serving site
|
||||
staticSite :: IO Static
|
||||
staticSite =
|
||||
#ifdef DEVELOPMENT
|
||||
Static.staticDevel staticDir
|
||||
#else
|
||||
Static.static staticDir
|
||||
#endif
|
||||
|
||||
-- | This generates easy references to files in the static directory at compile time,
|
||||
-- giving you compile-time verification that referenced files exist.
|
||||
-- Warning: any files added to your static directory during run-time can't be
|
||||
-- accessed this way. You'll have to use their FilePath or URL to access them.
|
||||
$(staticFiles "static")
|
||||
$(staticFiles Settings.staticDir)
|
||||
|
||||
|
||||
@ -9,7 +9,7 @@ Default: &defaults
|
||||
Development:
|
||||
<<: *defaults
|
||||
|
||||
Testing:
|
||||
Test:
|
||||
database: ~project~_test
|
||||
<<: *defaults
|
||||
|
||||
|
||||
@ -9,7 +9,7 @@ Default: &defaults
|
||||
Development:
|
||||
<<: *defaults
|
||||
|
||||
Testing:
|
||||
Test:
|
||||
database: ~project~_test
|
||||
<<: *defaults
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@ Default: &defaults
|
||||
Development:
|
||||
<<: *defaults
|
||||
|
||||
Testing:
|
||||
Test:
|
||||
<<: *defaults
|
||||
|
||||
Staging:
|
||||
|
||||
@ -5,7 +5,7 @@ Default: &defaults
|
||||
Development:
|
||||
<<: *defaults
|
||||
|
||||
Testing:
|
||||
Test:
|
||||
database: ~project~_test.sqlite3
|
||||
<<: *defaults
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ module Application
|
||||
|
||||
import Import
|
||||
import Settings
|
||||
import Yesod.Static
|
||||
import Settings.StaticFiles (staticSite)
|
||||
import Yesod.Default.Config
|
||||
import Yesod.Default.Main (defaultDevelApp, defaultRunner)
|
||||
import Yesod.Default.Handlers (getFaviconR, getRobotsR)
|
||||
@ -28,11 +28,7 @@ mkYesodDispatch "~sitearg~" resources~sitearg~
|
||||
-- migrations handled by Yesod.
|
||||
with~sitearg~ :: AppConfig DefaultEnv () -> Logger -> (Application -> IO ()) -> IO ()
|
||||
with~sitearg~ conf logger f = do
|
||||
#ifdef DEVELOPMENT
|
||||
s <- staticDevel Settings.staticDir
|
||||
#else
|
||||
s <- static Settings.staticDir
|
||||
#endif
|
||||
s <- staticSite
|
||||
let h = ~sitearg~ conf logger s
|
||||
defaultRunner f h
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user