aboutsummaryrefslogtreecommitdiff
path: root/tea-cleaner/TeaCleaner/Configuration.hs
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2025-04-13 12:10:56 +0200
committerEugen Wissner <belka@caraus.de>2025-04-13 12:10:56 +0200
commit0e6de99821d2262ada8e277fba1eb6059858ea41 (patch)
tree7a2c6f2d11e7c696eabd92cc8db2d955d3ed4f3c /tea-cleaner/TeaCleaner/Configuration.hs
parent5a4c882d409e4051001cdd64cbcef9a98fc2c6cf (diff)
downloadkazbek-0e6de99821d2262ada8e277fba1eb6059858ea41.tar.gz
tea-cleaner: Make no login period configurable
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")