darcsden-1.1: src/DarcsDen/Settings.hs
{-# OPTIONS_GHC -F -pgmF trhsx #-}
{-# LANGUAGE CPP #-}
module DarcsDen.Settings where
import HSP
import qualified Database.Redis.Redis as R
import Control.Monad.Trans (liftIO)
import DarcsDen.Util (doMarkdown')
multiuser, issuetrackers, deletefiles :: Bool
adminEmail, adminName, sendEmail, sendName, hostname, basePort, basePath, baseUrl, version, version', buildDate, buildTime, couchHost, redisHost, redisPort, githubAppIdVarName, githubAppPwdVarName, googleAppIdVarName, googleAppPwdVarName :: String
maxRequestTime, maxFileDisplaySize, maxPatchDisplaySize, couchPort :: Int
homeDir, usersDir, accessLog, errorLog, xdgMimePath :: FilePath
siteLink, siteFooter, frontPageContent :: HSP XML
-- hub.darcs.net settings:
-- optional features
multiuser = True -- Enable user registration ?
issuetrackers = True -- Enable optional issue trackers ?
deletefiles = True -- Delete repos from the filesystem when deleted in the web UI ?
-- app url
baseUrl = "http://" ++ hostname ++ basePort ++ basePath
hostname = "hub.darcs.net"
#ifndef DEBUG
basePort = ""
#else
basePort = ":8901"
#endif
basePath = "/" -- must end with a slash
-- To enable github integration, register an application at github.
-- Store the client id and client secret as environment variables
githubAppIdVarName = "GITHUB_CLIENT_ID"
githubAppPwdVarName = "GITHUB_CLIENT_SECRET"
-- To enable google integration, register an application at google.
-- Store the client id and client secret as environment variables
googleAppIdVarName = "GOOGLE_CLIENT_ID"
googleAppPwdVarName = "GOOGLE_CLIENT_SECRET"
-- contact info
adminEmail = "simon@joyful.com"
adminName = "Simon"
-- send address: you need to be able to send mails from
-- this address using the default sendmail executable
sendEmail = "darcsden@"++hostname
sendName = "darcsden"
-- resource limits
maxRequestTime = 30 -- granularity is 5s, precision is +/-5s
maxFileDisplaySize = 200000
maxPatchDisplaySize = 200000
-- filesystem
homeDir = "/home/darcsden"
usersDir = homeDir ++ "/users"
#ifndef DEBUG
accessLog = homeDir ++ "/log/access.log"
errorLog = homeDir ++ "/log/error.log"
#else
accessLog = "access.log"
errorLog = ""
#endif
xdgMimePath = "xdg-mime"
-- databases
couchHost = "127.0.0.1"
couchPort = 5984
redisHost = "127.0.0.1"
redisPort = R.defaultPort
-- content
version = "1.1"
#ifndef DEBUG
version' = version
#else
version' = version ++ " DEV"
#endif
buildDate = __DATE__
buildTime = __TIME__
siteLink = <a class="name" href=(baseUrl) style="font-size:36px;"><% hostname %></a>
siteFooter =
<ul>
<li><a href="http://hub.darcs.net/simon/darcsden">darcsden</a> <% version' %> built <% buildDate %> <% buildTime %></li>
<li><a href="http://stats.pingdom.com/olo874j6ixzj/632910">uptime</a></li>
<% if null adminEmail
then <% "" %>
else <% <li>report problems to <a href=("mailto:"++adminEmail++"?subject=darcsden:%20")><% adminName %></a> or <a href="irc://irc.freenode.net/#darcs">#darcs</a> or the <a href="http://hub.darcs.net/simon/darcsden/issues">issue tracker</a></li> %>
%>
</ul>
frontPageContent =
-- read front page content on each request for easy tweaking
do h <- liftIO $ doMarkdown' `fmap` (readFile $ homeDir ++ "/docs/README.md")
<div class="blurb markdown"><% cdata h %></div>