aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/Config.hs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/src/Config.hs')
-rw-r--r--compiler/src/Config.hs49
1 files changed, 49 insertions, 0 deletions
diff --git a/compiler/src/Config.hs b/compiler/src/Config.hs
new file mode 100644
index 0000000..6f04818
--- /dev/null
+++ b/compiler/src/Config.hs
@@ -0,0 +1,49 @@
1{-# LANGUAGE DuplicateRecordFields, DeriveGeneric, DeriveAnyClass #-}
2
3-- ldgallery - A static generator which turns a collection of tagged
4-- pictures into a searchable web gallery.
5--
6-- Copyright (C) 2019 Pacien TRAN-GIRARD
7--
8-- This program is free software: you can redistribute it and/or modify
9-- it under the terms of the GNU Affero General Public License as
10-- published by the Free Software Foundation, either version 3 of the
11-- License, or (at your option) any later version.
12--
13-- This program is distributed in the hope that it will be useful,
14-- but WITHOUT ANY WARRANTY; without even the implied warranty of
15-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16-- GNU Affero General Public License for more details.
17--
18-- You should have received a copy of the GNU Affero General Public License
19-- along with this program. If not, see <https://www.gnu.org/licenses/>.
20
21
22module Config
23 ( GalleryConfig(..)
24 , CompilerConfig(..)
25 , readConfig
26 ) where
27
28import GHC.Generics (Generic)
29import Data.Aeson (ToJSON, FromJSON)
30import qualified Data.Aeson as JSON
31
32import Files (FileName)
33import Input (decodeYamlFile)
34
35
36data CompilerConfig = CompilerConfig
37 { dummy :: Maybe String -- TODO
38 } deriving (Generic, FromJSON, Show)
39
40data GalleryConfig = GalleryConfig
41 { compiler :: CompilerConfig
42 , viewer :: JSON.Object
43 } deriving (Generic, FromJSON, Show)
44
45-- TODO: add compiler config keys and their default values
46
47
48readConfig :: FileName -> IO GalleryConfig
49readConfig = decodeYamlFile