🐙 Templated web page generator for your git repositories
git clone https://github.com/m-col/gitja
Files | Refs | Readme | License

Commit d3d59757eb803a9675c94109fb7de9755221cfa3
Parent: fdc7043afc2eb29bf0c7ef43779a852e9c39f739
Author: mcol <mcol@posteo.net>
Date: 2021-09-17 01:39:31 +0100
Committer: mcol <mcol@posteo.net>
Committed: 2021-09-17 01:39:50 +0100

Add example dhall config with config-reading code

src/Main.hs Modified

@@ -1,7 +1,11 @@
+{-# LANGUAGE OverloadedStrings #-}
 module Main where
 
+import Config (getConfig)
 import Repositories
 
 main :: IO ()
 main = do
-  getLog "."
+    config <- getConfig "./config.dhall"
+    print config
+    getLog "."

src/Config.hs Added

@@ -0,0 +1,18 @@
+{-# LANGUAGE DeriveGeneric #-}
+
+module Config (
+    getConfig
+) where
+
+import Dhall
+
+data Config = Config
+    { repoPaths :: [FilePath]
+    , outputDirectory :: FilePath
+    }
+    deriving (Generic, Show)
+
+instance FromDhall Config
+
+getConfig :: Text -> IO Config
+getConfig = input auto

gitserve.cabal Modified

@@ -16,9 +16,10 @@
 executable gitserve
   hs-source-dirs:      src
   main-is:             Main.hs
-  other-modules:       Repositories
+  other-modules:       Config, Repositories
   default-language:    Haskell2010
   build-depends:       base >= 4.7 && < 5
                      , gitlib
                      , gitlib-libgit2
                      , tagged
+                     , dhall

config.dhall Added

@@ -0,0 +1,18 @@
+-- This is an example configuration file for gitserve.
+-- It uses the Dhall configuration language: dhall-lang.org
+
+-- This is a folder containing repositories.
+let root = "."
+
+-- And these are relative paths from root to those repositories.
+let folders = [
+    "${root}/"
+    ]
+
+-- This is the configuration object that is used by gitserve
+let config =
+    { repoPaths = folders
+    , outputDirectory = "./output"
+    }
+
+in config

.gitignore Modified

@@ -1,2 +1,3 @@
 .stack-work/
-*~

\ No newline at end of file
+*~
+output