From 02e85ea26fc297d41a91c91d12b3e2aa290e62ff Mon Sep 17 00:00:00 2001 From: Igor Pashev Date: Mon, 28 Nov 2016 21:24:51 +0300 Subject: Allow running in plain HTTP mode (no SSL) This can be useful when Sproxy is behind some other proxy or load-balancer. --- src/Sproxy/Config.hs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/Sproxy/Config.hs') diff --git a/src/Sproxy/Config.hs b/src/Sproxy/Config.hs index e76b436..4cae025 100644 --- a/src/Sproxy/Config.hs +++ b/src/Sproxy/Config.hs @@ -17,14 +17,16 @@ import Sproxy.Logging (LogLevel(Debug)) data ConfigFile = ConfigFile { cfListen :: Word16 +, cfSsl :: Bool , cfUser :: String , cfHome :: FilePath , cfLogLevel :: LogLevel -, cfSslCert :: FilePath -, cfSslKey :: FilePath +, cfSslCert :: Maybe FilePath +, cfSslKey :: Maybe FilePath , cfSslCertChain :: [FilePath] , cfKey :: Maybe FilePath , cfListen80 :: Maybe Bool +, cfHttpsPort :: Maybe Word16 , cfBackends :: [BackendConf] , cfOAuth2 :: HashMap Text OAuth2Conf , cfDataFile :: Maybe FilePath @@ -36,14 +38,16 @@ data ConfigFile = ConfigFile { instance FromJSON ConfigFile where parseJSON (Object m) = ConfigFile <$> m .:? "listen" .!= 443 + <*> m .:? "ssl" .!= True <*> m .:? "user" .!= "sproxy" <*> m .:? "home" .!= "." <*> m .:? "log_level" .!= Debug - <*> m .: "ssl_cert" - <*> m .: "ssl_key" + <*> m .:? "ssl_cert" + <*> m .:? "ssl_key" <*> m .:? "ssl_cert_chain" .!= [] <*> m .:? "key" <*> m .:? "listen80" + <*> m .:? "https_port" <*> m .: "backends" <*> m .: "oauth2" <*> m .:? "datafile" -- cgit v1.2.3