module Hsm.Core.App ( launch ) where import Data.Aeson (FromJSON) import Data.Text (Text) import Effectful.Log (LogLevel, Logger) import Hsm.Core.Env (environment) import Hsm.Core.Options (Options(Options), options) import Log.Backend.StandardOutput (withStdOutLogger) launch :: FromJSON env => Text -> (IO app -> IO app) -> (env -> Logger -> LogLevel -> IO app) -> IO app launch name wrapper app = do Options path level <- options name env <- environment name path wrapper $ withStdOutLogger $ \logger -> app env logger level