-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConfigs.hs
More file actions
39 lines (32 loc) · 1.11 KB
/
Configs.hs
File metadata and controls
39 lines (32 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
{-|
Module : Configs
Description : Configuration definitions for the app.
Copyright : (c) Aleksi Tarvainen, 2025
License : BSD3
Maintainer : aleksi@atarv.dev
-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE StrictData #-}
module Configs where
import Dhall
-- | Base URL of Muusikoiden.net's services
baseUrl :: String
baseUrl = "https://muusikoiden.net"
data MailConfig = MailConfig
{ senderEmail :: !Text
, senderName :: !Text
} deriving (Show, Generic)
instance FromDhall MailConfig
-- | This includes all the necessary configurations for app
data AppConfig = AppConfig
{ mailConfig :: !MailConfig
, dynamoDBTableName :: !Text
} deriving (Generic, Show)
instance FromDhall AppConfig
-- | Loads configuration from file. If no path is given, configuration is loaded
-- from "./config.dhall". Dhall checks that the given configuration has the
-- types specified in this module.
loadConfig :: Maybe Text -> IO AppConfig
loadConfig Nothing = input auto "./config.dhall"
loadConfig (Just path) = input auto path