diff --git a/Dockerfile b/Dockerfile index 72e25c6..264576b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,12 @@ FROM python:3-alpine WORKDIR /usr/src/app -COPY checks.yaml ./ -COPY history.html.theme ./ -COPY incidents.md ./ -COPY index.html.theme ./ -COPY requirements.txt ./ -COPY tinystatus.py ./ +COPY checks.yaml \ + history.html.theme \ + incidents.md \ + index.html.theme \ + requirements.txt \ + tinystatus.py ./ RUN pip install --no-cache-dir -r requirements.txt CMD [ "python", "/usr/src/app/tinystatus.py" ] diff --git a/tinystatus.py b/tinystatus.py index dad5964..69f4876 100644 --- a/tinystatus.py +++ b/tinystatus.py @@ -54,13 +54,12 @@ async def run_checks(checks): background_tasks = {} async with asyncio.TaskGroup() as tg: for check in checks: - if check['type'] == 'http': - task = tg.create_task(check_http(check['host'], check['expected_code']), name=check['name']) - elif check['type'] == 'ping': - task = tg.create_task(check_ping(check['host']), name=check['name']) - elif check['type'] == 'port': - task = tg.create_task(check_port(check['host'], check['port']), name=check['name']) - + task = tg.create_task( + check_http(check['host'], check['expected_code']) if check['type'] == 'http' else + check_ping(check['host']) if check['type'] == 'ping' else + check_port(check['host'], check['port']) if check['type'] == 'port' else None, + name=check['name'] + ) if task: background_tasks[check['name']] = task