Skip to content
This repository was archived by the owner on Aug 1, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 21 additions & 17 deletions cardano-launcher/app/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -90,23 +90,27 @@ main = do
updaterData = getUpdaterData launcherOptions

-- where to generate the certificates
let tlsPath :: TLSPath
tlsPath = TLSPath $ loTlsPath launcherOptions

-- | If we need to, we first check if there are certificates so we don't have
-- to generate them. Since the function is called `generate...`, that's what
-- it does, it generates the certificates.
eTLSGeneration <- generateTlsCertificates
loggingDependencies
configurationOptions
tlsPath

case eTLSGeneration of
Left generationError -> do
Trace.logError baseTrace $
"Error occured while generating TLS certificates: " <> show generationError
throwM $ FailedToGenerateTLS generationError
Right _ -> return ()
let mTlsPath :: Maybe TLSPath
mTlsPath = TLSPath <$> loTlsPath launcherOptions


case mTlsPath of
Just tlsPath -> do
-- | If we need to, we first check if there are certificates so we don't have
-- to generate them. Since the function is called `generate...`, that's what
-- it does, it generates the certificates.
eTLSGeneration <- generateTlsCertificates
loggingDependencies
configurationOptions
tlsPath

case eTLSGeneration of
Left generationError -> do
Trace.logError baseTrace $
"Error occured while generating TLS certificates: " <> show generationError
throwM $ FailedToGenerateTLS generationError
Right _ -> return ()
Nothing -> pure () -- TLS generation has been disabled

-- In the case the user wants to avoid installing the update now, we
-- run the update (if there is one) when we have it downloaded.
Expand Down
4 changes: 2 additions & 2 deletions cardano-launcher/src/Cardano/Shell/Configuration.hs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ newtype WalletPath = WalletPath
-- | Launcher options
data LauncherOptions = LauncherOptions
{ loConfiguration :: !ConfigurationOptions
, loTlsPath :: !FilePath
, loTlsPath :: !(Maybe FilePath)
, loUpdaterPath :: !FilePath
, loUpdaterArgs :: ![Text]
, loUpdateArchive :: !FilePath
Expand All @@ -62,7 +62,7 @@ instance FromJSON LauncherOptions where
updaterArgs <- o .: "updaterArgs"
updateArchive <- o .: "updateArchive"
configuration <- o .: "configuration"
tlsPath <- o .: "tlsPath"
tlsPath <- o .:? "tlsPath"
workingDir <- o .: "workingDir"

pure $ LauncherOptions
Expand Down