From 9969093c915da99bbc32ddb33e5d086c215266fc Mon Sep 17 00:00:00 2001 From: sz11zs Date: Sun, 3 May 2026 09:50:32 +0200 Subject: [PATCH] init: hello-cicd projectsetup --- main.py | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/main.py b/main.py index a3befbd..617bdba 100644 --- a/main.py +++ b/main.py @@ -1,22 +1,17 @@ from fastapi import FastAPI -import os +import os, datetime app = FastAPI() -_healthy = True @app.get("/health") def health(): - if not _healthy: - return {"status": "unhealthy"}, 503 - return {"status": "ok"} - -@app.post("/break") -def break_health(): - """Simulira pad servisa za testiranje liveness probe-a""" - global _healthy - _healthy = False - return {"message": "Servis je sada nezdrav — ocekuj restart"} + return { + "status": "ok", + "version": os.getenv("APP_VERSION", "dev"), + "timestamp": datetime.datetime.utcnow().isoformat() + } @app.get("/") -def read_root(): - return {"poruka": "Hello iz mog Docker containera!"} +def root(): + return {"poruka": "Zdravo s k3s!", "host": os.uname().nodename} +