fix sorting and starting web sans ssl

This commit is contained in:
Lucy Cifferello
2021-01-19 15:45:24 -07:00
parent b1236bd52f
commit eb0df7f355
2 changed files with 5 additions and 4 deletions

View File

@@ -202,9 +202,10 @@ startWeb foundation = do
putStrLn @Text $ "Launching Tor Web Server on port " <> show torPort putStrLn @Text $ "Launching Tor Web Server on port " <> show torPort
torAction <- async $ runSettings (warpSettings torPort foundation) app torAction <- async $ runSettings (warpSettings torPort foundation) app
putStrLn @Text $ "Launching Web Server on port " <> show appPort putStrLn @Text $ "Launching Web Server on port " <> show appPort
action <- async $ runTLS (tlsSettings sslCertLocation sslKeyLocation) action <- if sslAuto
(warpSettings appPort foundation) then async $ runTLS (tlsSettings sslCertLocation sslKeyLocation)
app (warpSettings appPort foundation) app
else async $ runSettings (warpSettings appPort foundation) app
let actions = (action, torAction) let actions = (action, torAction)
setWebProcessThreadId (join (***) asyncThreadId actions) foundation setWebProcessThreadId (join (***) asyncThreadId actions) foundation

View File

@@ -40,7 +40,7 @@ getAvailableAppVersions rootDirectory ext@(Extension appId) = do
getMostRecentAppVersion :: KnownSymbol a => FilePath -> Extension a -> IO (Maybe RegisteredAppVersion) getMostRecentAppVersion :: KnownSymbol a => FilePath -> Extension a -> IO (Maybe RegisteredAppVersion)
getMostRecentAppVersion rootDirectory ext = do getMostRecentAppVersion rootDirectory ext = do
allVersions <- liftIO $ getAvailableAppVersions rootDirectory ext allVersions <- liftIO $ getAvailableAppVersions rootDirectory ext
pure $ head $ sortOn (fst . unRegisteredAppVersion) allVersions pure $ head $ sortOn (Down . fst . unRegisteredAppVersion) allVersions
-- /root/appId/version/appId.ext -- /root/appId/version/appId.ext
getVersionedFileFromDir :: KnownSymbol a => FilePath -> Extension a -> Version -> IO (Maybe FilePath) getVersionedFileFromDir :: KnownSymbol a => FilePath -> Extension a -> Version -> IO (Maybe FilePath)