aboutsummaryrefslogtreecommitdiff
path: root/tea-cleaner/TeaCleaner/Configuration.hs
diff options
context:
space:
mode:
Diffstat (limited to 'tea-cleaner/TeaCleaner/Configuration.hs')
-rw-r--r--tea-cleaner/TeaCleaner/Configuration.hs10
1 files changed, 6 insertions, 4 deletions
diff --git a/tea-cleaner/TeaCleaner/Configuration.hs b/tea-cleaner/TeaCleaner/Configuration.hs
index dad1450..b958264 100644
--- a/tea-cleaner/TeaCleaner/Configuration.hs
+++ b/tea-cleaner/TeaCleaner/Configuration.hs
@@ -37,6 +37,7 @@ data ConfigFile = ConfigFile
, server :: StrictText
, spamWords :: [StrictText]
, mailDomains :: [StrictText]
+ , noLogin :: Word
} deriving (Eq, Show)
configFileCodec :: Toml.TomlCodec ConfigFile
@@ -45,6 +46,7 @@ configFileCodec = ConfigFile
<*> Toml.text "server" .= getField @"server"
<*> Toml.arrayOf Toml._Text "spam_words" .= getField @"spamWords"
<*> Toml.arrayOf Toml._Text "mail_domains" .= getField @"mailDomains"
+ <*> Toml.word "no_login" .= getField @"noLogin"
data Settings = Settings
{ token :: StrictText
@@ -53,6 +55,7 @@ data Settings = Settings
, spamWords :: [StrictText]
, mailDomains :: [StrictText]
, statistics :: IORef Int
+ , noLogin :: Word
} deriving Eq
decodeSettingsFile :: FilePath -> IO Settings
@@ -67,11 +70,12 @@ decodeSettingsFile configPath = do
, now = now
, spamWords = spamWords
, mailDomains = mailDomains
+ , noLogin = noLogin
, statistics = ioRef
}
newtype ProgramOptions = ProgramOptions
- { liveRun :: Bool
+ { live :: Bool
} deriving (Eq, Show)
commandLineInfo :: ParserInfo ProgramOptions
@@ -80,6 +84,4 @@ commandLineInfo = info (commandLine <**> helper)
commandLine :: Parser ProgramOptions
commandLine = ProgramOptions
- <$> liveRunOption
- where
- liveRunOption = switch $ long "live-run" <> help "Purge suspicious users"
+ <$> switch (long "live" <> help "Purge suspicious users")