made the config file format a bit more sensible
This commit is contained in:
parent
480ffba3f9
commit
cbc22ea207
2 changed files with 14 additions and 13 deletions
13
README.md
13
README.md
|
@ -16,12 +16,13 @@ The config file is a toml file, even though it as of now makes not really use
|
||||||
of any toml features.
|
of any toml features.
|
||||||
|
|
||||||
```toml
|
```toml
|
||||||
mailDomain = "the domain of the smtp server to send messages with"
|
[mail]
|
||||||
mailUser = "the username on the smtp server"
|
domain = "the domain of the smtp server to send messages with"
|
||||||
mailPassword = "the passwond on the smtp server"
|
user = "the username on the smtp server"
|
||||||
mailTo = "the mail to send to"
|
password = "the passwond on the smtp server"
|
||||||
mailFrom = "the sender of the mail"
|
to = "the mail to send to"
|
||||||
mailErrorTo = "the address to send a mail to in case of error"
|
from = "the sender of the mail"
|
||||||
|
errorTo = "the address to send a mail to in case of error"
|
||||||
```
|
```
|
||||||
|
|
||||||
## Develop
|
## Develop
|
||||||
|
|
|
@ -16,13 +16,13 @@ data Config = Config {
|
||||||
} deriving Show
|
} deriving Show
|
||||||
|
|
||||||
configCodec :: TomlCodec Config
|
configCodec :: TomlCodec Config
|
||||||
configCodec = Config
|
configCodec = table "mail" $ Config
|
||||||
<$> Toml.string "mailDomain" .= mailDomain
|
<$> Toml.string "domain" .= mailDomain
|
||||||
<*> Toml.string "mailUser" .= mailUsername
|
<*> Toml.string "user" .= mailUsername
|
||||||
<*> Toml.string "mailPassword" .= mailPassword
|
<*> Toml.string "password" .= mailPassword
|
||||||
<*> Toml.text "mailTo" .= mailTo
|
<*> Toml.text "to" .= mailTo
|
||||||
<*> Toml.text "mailFrom" .= mailFrom
|
<*> Toml.text "from" .= mailFrom
|
||||||
<*> Toml.text "mailErrorTo" .= mailErrorTo
|
<*> Toml.text "errorTo" .= mailErrorTo
|
||||||
|
|
||||||
parseConfigFile :: (MonadIO m, MonadFail m) => String -> m Config
|
parseConfigFile :: (MonadIO m, MonadFail m) => String -> m Config
|
||||||
parseConfigFile path = do
|
parseConfigFile path = do
|
||||||
|
|
Loading…
Reference in a new issue