aboutsummaryrefslogtreecommitdiff
path: root/src/Sproxy/Config.hs
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2016-11-28 21:24:51 +0300
committerIgor Pashev <pashev.igor@gmail.com>2016-11-28 21:24:51 +0300
commit02e85ea26fc297d41a91c91d12b3e2aa290e62ff (patch)
treeada741648b692860796b289beef68944cfec00e4 /src/Sproxy/Config.hs
parent389d4b0904c718bdabbce400b8fe9a8f0fcb9f80 (diff)
downloadsproxy2-02e85ea26fc297d41a91c91d12b3e2aa290e62ff.tar.gz
Allow running in plain HTTP mode (no SSL)
This can be useful when Sproxy is behind some other proxy or load-balancer.
Diffstat (limited to 'src/Sproxy/Config.hs')
-rw-r--r--src/Sproxy/Config.hs12
1 files changed, 8 insertions, 4 deletions
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"