From 062fb5539a9bb64f226f0f35bf19390bea5c0e20 Mon Sep 17 00:00:00 2001 From: fr33domlover Date: Sat, 5 Mar 2016 03:56:25 +0000 Subject: [PATCH] Add app settings for SSH server --- _boring | 2 ++ config/settings.yml | 8 +++++--- src/Vervis/Settings.hs | 9 +++++++-- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/_boring b/_boring index 3119854..0ff5791 100644 --- a/_boring +++ b/_boring @@ -123,4 +123,6 @@ ^yesod-devel(/|$) ### vervis +^config/ssh-private-key$ +^config/ssh-private-key\.pub$ ^repos(/|$) diff --git a/config/settings.yml b/config/settings.yml index 5ca2601..cccb679 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -8,7 +8,7 @@ host: "_env:HOST:*4" # The port `yesod devel` uses is distinct from this value. Set the # `yesod devel` port from the command line. -port: "_env:PORT:3000" +http-port: "_env:PORT:3000" ip-from-header: "_env:IP_FROM_HEADER:false" @@ -38,5 +38,7 @@ database: database: "_env:PGDATABASE:vervis_dev" poolsize: "_env:PGPOOLSIZE:10" -repo-dir: repos -copyright: Insert your statement against copyright here +repo-dir: repos +ssh-port: 5022 +ssh-key-file: config/ssh-private-key +copyright: Insert your statement against copyright here diff --git a/src/Vervis/Settings.hs b/src/Vervis/Settings.hs index 7bfbff3..b6fd022 100644 --- a/src/Vervis/Settings.hs +++ b/src/Vervis/Settings.hs @@ -69,9 +69,12 @@ data AppSettings = AppSettings , appSkipCombining :: Bool -- ^ Perform no stylesheet/script combining - -- Example app-specific configuration values. , appRepoDir :: FilePath -- ^ Path to the directory under which git repos are placed + , appSshPort :: Int + -- ^ Port for the SSH server component to listen on + , appSshKeyFile :: FilePath + -- ^ Path to the server's SSH private key file , appCopyright :: Text -- ^ Copyright text to appear in the footer of the page } @@ -88,7 +91,7 @@ instance FromJSON AppSettings where appDatabaseConf <- o .: "database" appRoot <- o .:? "approot" appHost <- fromString <$> o .: "host" - appPort <- o .: "port" + appPort <- o .: "http-port" appIpFromHeader <- o .: "ip-from-header" appDetailedRequestLogging <- o .:? "detailed-logging" .!= defaultDev @@ -98,6 +101,8 @@ instance FromJSON AppSettings where appSkipCombining <- o .:? "skip-combining" .!= defaultDev appRepoDir <- o .: "repo-dir" + appSshPort <- o .: "ssh-port" + appSshKeyFile <- o .: "ssh-key-file" appCopyright <- o .: "copyright" return AppSettings {..}