darcs repository web UI and hosting app. This is the main darcsden trunk, which also runs hub.darcs.net. (https://hub.darcs.net)
#136use a proper configuration file instead of Settings.hs
That would be nice. I might start working on it. Anything important to keep in mind for that? File location?
Oh, this can be done with the reflection package pretty easily! https://hackage.haskell.org/package/reflection
example use
{-# LANGUAGE Rank2Types, FlexibleContexts, UndecidableInstances #-} import Data.Reflection data GlobalConfig = MkGlobalConfig { getVal1 :: Int , getVal2 :: Double , getVal3 :: String } main :: IO () main = do let config = MkGlobalConfig 1 2.0 "test" -- initialize the program flow via 'give' print $ give config (doSomething "something" 2) -- this works too, the type is properly inferred print $ give config (3 + 3) -- and this as well print $ give config (addInt 7 3) -- since we call 'given' inside the function, we need the Given constraint doSomething :: (Given GlobalConfig) => String -> Int -> Int doSomething str x | str == "something" = x + getVal1 given | getVal3 given == "test" = 0 + getVal1 given | otherwise = round (fromIntegral x * getVal2 given) -- no need for Given constraint here addInt :: Int -> Int -> Int addInt = (+)
http://hub.darcs.net/maerwald/darcsden/patch/20150510190023-0bd70
todo: actually READ user configuration
config file parsing and merging with default settings could probably be done with https://hackage.haskell.org/package/ConfigFile-1.1.3/docs/Data-ConfigFile.html
Deployed and working great, thanks!
Now I just want a better solution for customizing web content like the site footer, which currently still requires keeping unrecorded Production.hs changes around.
Yep, we need to go deeper http://i1.kym-cdn.com/photos/images/original/000/531/557/a88.jpg
The question is... do we care if the user can access configuration variables within the site-footer etc context? Because that will definitely not be easy.
It'd be nice to be able to keep the automatic version string and build timestamp there if possible.
- added tag in-progress