async def get_health(request):
    try:
        await pg.fetch('SELECT 42')

    except Exception:
        # Just making sure we can get a successful connection/query
        # if we cant, we are not healthy
        request.app.raven.captureException(extra={'health_check': True},
                                           level='warning')
        return responses.PlainTextResponse('cant access db', status_code=503)
        # return web.HTTPServiceUnavailable(reason='cant access db')

    return responses.PlainTextResponse("All is well")
async def config_validator(
        data: fastapi.UploadFile = fastapi.File(...),  # noqa: B008
) -> responses.PlainTextResponse:  # pragma: no cover
    try:
        bytes_or_str = await data.read()

        if isinstance(bytes_or_str, str):
            content_bytes = bytes_or_str.encode()
        else:
            content_bytes = bytes_or_str

        rules.get_mergify_config(
            context.MergifyConfigFile({
                "path":
                data.filename,
                "type":
                "file",
                "content":
                base64.b64encode(content_bytes).decode(),
                "decoded_content":
                content_bytes,
                "sha":
                github_types.SHAType(
                    hashlib.sha1(content_bytes).hexdigest()  # nosec
                ),
            }))
    except Exception as e:
        status = 400
        message = str(e)
    else:
        status = 200
        message = "The configuration is valid"

    return responses.PlainTextResponse(message, status_code=status)
async def config_validator(
        data: fastapi.UploadFile = fastapi.File(...), ):  # pragma: no cover
    try:
        rules.UserConfigurationSchema(await data.read())
    except Exception as e:
        status = 400
        message = str(e)
    else:
        status = 200
        message = "The configuration is valid"

    return responses.PlainTextResponse(message, status_code=status)