#!/usr/bin/env python3
"""
tykkää.fi dev server — launches PHP built-in server
so that api.php, upload.php and static files all work.
"""
import os, subprocess, sys
from pathlib import Path

PORT = 3000

if __name__ == '__main__':
    os.chdir(Path(__file__).parent)
    print(f'tykkää.fi running at http://localhost:{PORT}')
    try:
        subprocess.run(
            ['php', '-S', f'localhost:{PORT}'],
            check=True,
        )
    except KeyboardInterrupt:
        print('\nSammutettu.')
