from fastapi import FastAPI, Response import os # Gebruik een omgevingsvariable. Tijdens het deployen van de applicatie kan # deze worden meegegeven, bijvoorbeeld als configMap maar ook als 'fixed'value vanuit de # deployment manifest. name = os.getenv("HELLO_NAME", "unknown") hostname = os.getenv("HOSTNAME") version = os.getenv("PYTHON_VERSION") api = FastAPI() @api.get("/") async def root(): return f"This is python version {version} in container {hostname}" @api.get("/hello") async def hello(): return f"Hello {name}!!!" @api.get("/healthz") async def healthz(): return "OK"