From 0e6de99821d2262ada8e277fba1eb6059858ea41 Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Sun, 13 Apr 2025 12:10:56 +0200 Subject: tea-cleaner: Make no login period configurable --- tea-cleaner/TeaCleaner/Configuration.hs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'tea-cleaner/TeaCleaner/Configuration.hs') 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") -- cgit v1.2.3