Import more from Settings
This commit is contained in:
parent
5da5fb8174
commit
f99a64e372
@ -1,6 +1,5 @@
|
|||||||
{-# LANGUAGE CPP, DeriveDataTypeable #-}
|
{-# LANGUAGE CPP, DeriveDataTypeable #-}
|
||||||
import qualified Settings as Settings
|
import Settings (AppEnvironment(..), AppConfig(..), loadConfig)
|
||||||
import Settings (AppConfig(..))
|
|
||||||
import Application (with~sitearg~)
|
import Application (with~sitearg~)
|
||||||
import Network.Wai.Handler.Warp (run)
|
import Network.Wai.Handler.Warp (run)
|
||||||
import System.Console.CmdArgs hiding (args)
|
import System.Console.CmdArgs hiding (args)
|
||||||
@ -18,7 +17,7 @@ main = do
|
|||||||
logger <- makeLogger
|
logger <- makeLogger
|
||||||
args <- cmdArgs argConfig
|
args <- cmdArgs argConfig
|
||||||
env <- getAppEnv args
|
env <- getAppEnv args
|
||||||
config <- Settings.loadConfig env
|
config <- loadConfig env
|
||||||
let c = if (port args) /= 0 then config {appPort = (port args) } else config
|
let c = if (port args) /= 0 then config {appPort = (port args) } else config
|
||||||
#if PRODUCTION
|
#if PRODUCTION
|
||||||
with~sitearg~ c logger $ run (appPort c)
|
with~sitearg~ c logger $ run (appPort c)
|
||||||
@ -41,10 +40,10 @@ argConfig = ArgConfig{ environment = def
|
|||||||
}
|
}
|
||||||
|
|
||||||
environments :: [String]
|
environments :: [String]
|
||||||
environments = map ((map toLower) . show) ([minBound..maxBound] :: [Settings.AppEnvironment])
|
environments = map ((map toLower) . show) ([minBound..maxBound] :: [AppEnvironment])
|
||||||
|
|
||||||
-- | retrieve the -e environment option
|
-- | retrieve the -e environment option
|
||||||
getAppEnv :: ArgConfig -> IO Settings.AppEnvironment
|
getAppEnv :: ArgConfig -> IO AppEnvironment
|
||||||
getAppEnv cfg = do
|
getAppEnv cfg = do
|
||||||
let e = if (environment cfg) /= "" then (environment cfg)
|
let e = if (environment cfg) /= "" then (environment cfg)
|
||||||
else
|
else
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user