static path for appmgr and other feedback

This commit is contained in:
Lucy Cifferello
2020-10-07 16:47:05 -06:00
parent 0e1e77f4b6
commit 846b1d7754
6 changed files with 12 additions and 15 deletions

View File

@@ -88,20 +88,14 @@ getSysR e = do
getAppManifestR :: Extension "s9pk" -> Text -> Handler TypedContent
getAppManifestR e@(Extension appId) v = do
appmgrVersion <- lookupGetParam "appmgr" >>= \case
Nothing -> sendResponseStatus status400 ("Appmgr version required" :: Text)
Just a -> pure $ toS a
appMgrDir <- (<> "/") . (</> appmgrVersion) . (</> "appmgr") . (</> "sys") . resourcesDir . appSettings <$> getYesod
appMgrDir <- (<> "/") . staticBinDir . appSettings <$> getYesod
appDir <- (<> "/") . (</> toS v) . (</> appId) . (</> "apps") . resourcesDir . appSettings <$> getYesod
manifest <- handleS9ErrT $ getManifest appMgrDir appDir e
pure $ TypedContent "application/json" (toContent manifest)
getAppConfigR :: Extension "s9pk" -> Text -> Handler TypedContent
getAppConfigR e@(Extension appId) v = do
appmgrVersion <- lookupGetParam "appmgr" >>= \case
Nothing -> sendResponseStatus status400 ("Appmgr version required" :: Text)
Just a -> pure $ toS a
appMgrDir <- (<> "/") . (</> appmgrVersion) . (</> "appmgr") . (</> "sys") . resourcesDir . appSettings <$> getYesod
appMgrDir <- (<> "/") . staticBinDir . appSettings <$> getYesod
appDir <- (<> "/") . (</> toS v) . (</> appId) . (</> "apps") . resourcesDir . appSettings <$> getYesod
config <- handleS9ErrT $ getConfig appMgrDir appDir e
pure $ TypedContent "application/json" (toContent config)