blob: a23cc7d6e6ce1e4edd0e68def34e3a49731b0a39 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
{-# LANGUAGE TemplateHaskell #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Regfish.Default () where
import Data.Default
import Regfish.Types
import System.Environment (getEnv)
import System.IO.Unsafe (unsafePerformIO)
instance Default RFConfig where
def = RFConfig
{ _username = user
, _password = pass
, _allinone = mkAllInOne domain
}
where
(user, pass, domain) =
unsafePerformIO $
(,,) <$> getEnv "REGFISH_USER"
<*> getEnv "REGFISH_PASS"
<*> getEnv "REGFISH_DOMAIN"
instance Default RFState where
def = RFState mempty
mkAllInOne :: String -> String
mkAllInOne domain =
"https://www.regfish.de/my/domains/*/"++tld++"/"++sld++"/rr/allinone"
where
(sld, '.':tld) = break (=='.') domain
|