summaryrefslogtreecommitdiff
path: root/lib/SlackBuilder/Config.hs
diff options
context:
space:
mode:
Diffstat (limited to 'lib/SlackBuilder/Config.hs')
-rw-r--r--lib/SlackBuilder/Config.hs15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/SlackBuilder/Config.hs b/lib/SlackBuilder/Config.hs
index 8e627e3..7160215 100644
--- a/lib/SlackBuilder/Config.hs
+++ b/lib/SlackBuilder/Config.hs
@@ -6,6 +6,7 @@
module SlackBuilder.Config
( Settings(..)
, MaintainerSettings(..)
+ , PackageSettings(..)
, settingsCodec
) where
@@ -21,12 +22,19 @@ data Settings = Settings
, downloadURL :: Text
, uploadCommand :: NonEmpty Text
, maintainer :: MaintainerSettings
+ , packages :: [PackageSettings]
} deriving (Eq, Show)
newtype MaintainerSettings = MaintainerSettings
{ signature :: Bool
} deriving (Eq, Show)
+data PackageSettings = PackageSettings
+ { name :: Text
+ , template :: Text
+ , is64 :: Bool
+ } deriving (Eq, Show)
+
settingsCodec :: Toml.TomlCodec Settings
settingsCodec = Settings
<$> Toml.text "gh_token" .= ghToken
@@ -35,7 +43,14 @@ settingsCodec = Settings
<*> Toml.text "download_url" .= downloadURL
<*> Toml.arrayNonEmptyOf Toml._Text "upload_command" .= uploadCommand
<*> Toml.table maintainerSettingsCodec "maintainer" .= maintainer
+ <*> Toml.list packageSettingsCodec "package" .= packages
maintainerSettingsCodec :: Toml.TomlCodec MaintainerSettings
maintainerSettingsCodec = MaintainerSettings
<$> Toml.bool "signature" .= signature
+
+packageSettingsCodec :: Toml.TomlCodec PackageSettings
+packageSettingsCodec = PackageSettings
+ <$> Toml.text "name" .= name
+ <*> Toml.text "template" .= template
+ <*> Toml.bool "is64" .= is64