only run if ssl has been setup

This commit is contained in:
Keagan McClelland
2020-12-01 11:22:53 -07:00
parent 06c6805b3f
commit f14493a93c

View File

@@ -448,11 +448,16 @@ syncConvertEcdsaCerts :: SyncOp
syncConvertEcdsaCerts = SyncOp "Convert Intermediate Cert to ECDSA P256" check migrate False
where
check = do
fs <- asks $ appFilesystemBase . appSettings
header <- liftIO $ headMay . lines <$> readFile (toS $ intermediateCaKeyPath `relativeTo` fs)
pure $ case header of
Nothing -> False
Just y -> "BEGIN RSA PRIVATE KEY" `T.isInfixOf` y
fs <- asks $ appFilesystemBase . appSettings
let intCertKey = toS $ intermediateCaKeyPath `relativeTo` fs
exists <- liftIO $ doesPathExist intCertKey
if exists
then do
header <- liftIO $ headMay . lines <$> readFile intCertKey
pure $ case header of
Nothing -> False
Just y -> "BEGIN RSA PRIVATE KEY" `T.isInfixOf` y
else pure False
migrate = cantFail $ do
base <- asks $ appFilesystemBase . appSettings
(runM . runExceptT) (injectFilesystemBase base replaceDerivativeCerts) >>= \case