serverman/src/System/Serverman.hs

36 lines
1.3 KiB
Haskell
Raw Normal View History

2017-02-18 19:25:57 +00:00
module System.Serverman ( run
, module System.Serverman.Action
, module System.Serverman.Utils
, module System.Serverman.Services
, module System.Serverman.Actions.WebServer
, module System.Serverman.Actions.Database
2017-02-18 19:25:57 +00:00
, module System.Serverman.Actions.Env
, module System.Serverman.Actions.Install) where
import System.Serverman.Action
import System.Serverman.Utils
import System.Serverman.Services
2017-02-18 19:25:57 +00:00
import System.Serverman.Actions.Install
import System.Serverman.Actions.Env
import System.Serverman.Actions.WebServer
import System.Serverman.Actions.Nginx
import System.Serverman.Actions.Database
import System.Serverman.Actions.MySQL
2017-02-18 19:25:57 +00:00
import Control.Monad.Free
run :: Action r -> IO r
run (Pure r) = return r
run (Free (NewWebServer params next))
| serverService params == NGINX = nginx params >> run next
2017-02-18 19:25:57 +00:00
| otherwise = run next
run (Free (DetectOS next)) = getOS >>= run . next
run (Free (Install os service next)) = installService os service >> run next
run (Free (NewDatabase params next))
| databaseService params == MySQL = mysql params >> run next
| otherwise = run next
2017-02-18 19:25:57 +00:00