tea-cleaner: Make no login period configurable
This commit is contained in:
@ -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")
|
||||
|
Reference in New Issue
Block a user