-- Posting CSRs
handlePostCSR :: Notifier -> AppState -> ActionM ()
handlePostCSR notify state = do
  now             <- liftIO getCurrentTime
  csrId           <- liftIO (fmap CSRID nextRandom)
  csrBody         <- param "csr"
  maybeCsrBuilder <- liftIO (parseCSR csrBody)
  clientIP        <- fmap (showSockAddr . remoteHost) request
  case maybeCsrBuilder of
    Nothing        -> serveError badRequest400 "Could not parse CSR"
    (Just builder) -> do
      let csr = builder csrId (RequestingHost $ pack clientIP) now Pending
      storeCSR state csr
      status created201
      notify csr
      json csr
handlePostCSR :: Notifier -> AppState -> ActionM ()
handlePostCSR notify state = do
  now             <- liftIO getCurrentTime
  csrId           <- liftIO (fmap CSRID nextRandom)
  csrBody         <- param "csr"
  maybeCsrBuilder <- liftIO (parseCSR csrBody)
  clientIP        <- fmap (showSockAddr . remoteHost) request
  case maybeCsrBuilder of
    Nothing        -> serveError badRequest400 "Could not parse CSR"
    (Just builder) -> do
      let csr = builder csrId (RequestingHost $ pack clientIP) now Pending
      storeCSR state csr
      status created201
      notify csr
      json csr
handlePostCSR notify state = do
  now             <- liftIO getCurrentTime
  csrId           <- liftIO (fmap CSRID nextRandom)
  csrBody         <- param "csr"
  maybeCsrBuilder <- liftIO (parseCSR csrBody)
  clientIP        <- fmap (showSockAddr . remoteHost) request
  case maybeCsrBuilder of
    Nothing        -> serveError badRequest400 "Could not parse CSR"
    (Just builder) -> do
      let csr = builder csrId (RequestingHost $ pack clientIP) now Pending
      storeCSR state csr
      status created201
      notify csr
      json csr