Skip to content
This repository was archived by the owner on Aug 1, 2023. It is now read-only.

Commit 8abae42

Browse files
authored
automatically disable tls if no path is supplied (#321)
1 parent c0da728 commit 8abae42

File tree

2 files changed

+23
-19
lines changed

2 files changed

+23
-19
lines changed

cardano-launcher/app/Main.hs

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -90,23 +90,27 @@ main = do
9090
updaterData = getUpdaterData launcherOptions
9191

9292
-- where to generate the certificates
93-
let tlsPath :: TLSPath
94-
tlsPath = TLSPath $ loTlsPath launcherOptions
95-
96-
-- | If we need to, we first check if there are certificates so we don't have
97-
-- to generate them. Since the function is called `generate...`, that's what
98-
-- it does, it generates the certificates.
99-
eTLSGeneration <- generateTlsCertificates
100-
loggingDependencies
101-
configurationOptions
102-
tlsPath
103-
104-
case eTLSGeneration of
105-
Left generationError -> do
106-
Trace.logError baseTrace $
107-
"Error occured while generating TLS certificates: " <> show generationError
108-
throwM $ FailedToGenerateTLS generationError
109-
Right _ -> return ()
93+
let mTlsPath :: Maybe TLSPath
94+
mTlsPath = TLSPath <$> loTlsPath launcherOptions
95+
96+
97+
case mTlsPath of
98+
Just tlsPath -> do
99+
-- | If we need to, we first check if there are certificates so we don't have
100+
-- to generate them. Since the function is called `generate...`, that's what
101+
-- it does, it generates the certificates.
102+
eTLSGeneration <- generateTlsCertificates
103+
loggingDependencies
104+
configurationOptions
105+
tlsPath
106+
107+
case eTLSGeneration of
108+
Left generationError -> do
109+
Trace.logError baseTrace $
110+
"Error occured while generating TLS certificates: " <> show generationError
111+
throwM $ FailedToGenerateTLS generationError
112+
Right _ -> return ()
113+
Nothing -> pure () -- TLS generation has been disabled
110114

111115
-- In the case the user wants to avoid installing the update now, we
112116
-- run the update (if there is one) when we have it downloaded.

cardano-launcher/src/Cardano/Shell/Configuration.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ newtype WalletPath = WalletPath
4343
-- | Launcher options
4444
data LauncherOptions = LauncherOptions
4545
{ loConfiguration :: !ConfigurationOptions
46-
, loTlsPath :: !FilePath
46+
, loTlsPath :: !(Maybe FilePath)
4747
, loUpdaterPath :: !FilePath
4848
, loUpdaterArgs :: ![Text]
4949
, loUpdateArchive :: !FilePath
@@ -62,7 +62,7 @@ instance FromJSON LauncherOptions where
6262
updaterArgs <- o .: "updaterArgs"
6363
updateArchive <- o .: "updateArchive"
6464
configuration <- o .: "configuration"
65-
tlsPath <- o .: "tlsPath"
65+
tlsPath <- o .:? "tlsPath"
6666
workingDir <- o .: "workingDir"
6767

6868
pure $ LauncherOptions

0 commit comments

Comments
 (0)