feat: proof of concept config parse
Signed-off-by: Christina Sørensen <christina@cafkafk.com>
This commit is contained in:
parent
f470601503
commit
de41aa4dc2
1 changed files with 8 additions and 0 deletions
|
@ -14,6 +14,9 @@ import qualified Data.Yaml as Y
|
|||
import GHC.Generics
|
||||
import Data.Aeson
|
||||
|
||||
data Cred = Cred { example :: String, other :: String } deriving (Show, Generic) -- (1,2)
|
||||
instance FromJSON Cred -- (3)
|
||||
|
||||
getRandomMaidIndex :: (MonadRandom m) => m Int
|
||||
getRandomMaidIndex = do
|
||||
let n = length maids - 1
|
||||
|
@ -91,6 +94,11 @@ performCleanup = do
|
|||
|
||||
main :: IO ()
|
||||
main = do
|
||||
content <- BS.readFile "config.yaml" -- (4)
|
||||
let parsedContent = Y.decode content :: Maybe Cred -- (5)
|
||||
case parsedContent of
|
||||
Nothing -> putStrLn "[-] no config found"
|
||||
(Just (Cred u p)) -> putStrLn ("[+] example: " ++ u ++ ", other: " ++ p)
|
||||
maid <- getRandomMaid
|
||||
putStrLn maid
|
||||
putStrLn "[+] !!!Cleaning Time!!!"
|
||||
|
|
Loading…
Reference in a new issue