2019-07-23 07:24:02 +02:00
|
|
|
module Myriad
|
|
|
|
( runMyriadServer
|
|
|
|
) where
|
|
|
|
|
2019-07-23 07:40:45 +02:00
|
|
|
import Control.Monad.Logger (runStdoutLoggingT)
|
|
|
|
|
|
|
|
import Data.String.Conversions
|
2019-07-23 07:24:02 +02:00
|
|
|
import qualified Data.Text as T
|
|
|
|
|
2019-07-23 07:40:45 +02:00
|
|
|
import Network.Wai.Handler.Warp
|
2019-07-23 07:24:02 +02:00
|
|
|
|
|
|
|
import Myriad.Core
|
|
|
|
import Myriad.Docker
|
|
|
|
import Myriad.Server
|
|
|
|
|
|
|
|
runMyriadServer :: T.Text -> IO ()
|
|
|
|
runMyriadServer configInput = do
|
|
|
|
env <- initEnv configInput
|
|
|
|
runMyriadT env do
|
|
|
|
buildAllImages
|
|
|
|
startCleanup
|
|
|
|
logInfo ["Finished Docker-related setup"]
|
2019-07-23 07:40:45 +02:00
|
|
|
let myriadPort = fromIntegral . port $ config env
|
|
|
|
onReady = runStdoutLoggingT $ logInfo ["Server started on port ", cs $ show myriadPort, "!"]
|
|
|
|
settings = setPort myriadPort . setBeforeMainLoop onReady $ defaultSettings
|
|
|
|
runSettings settings $ app env
|