-- | Main entry point.
main :: IO ()
main = do
  cpath:action <- getArgs
  config <- getConfig cpath
  pool <- newPool (configPostgres config)
  let db = runDB () config pool
  case foldr const "" action of
    "complete-import" ->
      importRecent False config pool
    "fast-import" ->
      importRecent True config pool
    "generate-data" -> do
      db $ migrate False versions
      db $ generateData
      clearCache config
    _ -> do
      db $ migrate False versions
      runServer config pool
main :: IO ()
main = do
  cpath:action <- getArgs
  config <- getConfig cpath
  pool <- newPool (configPostgres config)
  let db = runDB () config pool
  case foldr const "" action of
    "complete-import" ->
      importRecent False config pool
    "fast-import" ->
      importRecent True config pool
    "generate-data" -> do
      db $ migrate False versions
      db $ generateData
      clearCache config
    _ -> do
      db $ migrate False versions
      runServer config pool
main = do
  cpath:action <- getArgs
  config <- getConfig cpath
  pool <- newPool (configPostgres config)
  let db = runDB () config pool
  case foldr const "" action of
    "complete-import" ->
      importRecent False config pool
    "fast-import" ->
      importRecent True config pool
    "generate-data" -> do
      db $ migrate False versions
      db $ generateData
      clearCache config
    _ -> do
      db $ migrate False versions
      runServer config pool