update image to 1.1
This commit is contained in:
15
app/main.py
15
app/main.py
@@ -2,10 +2,23 @@ from fastapi import FastAPI
|
|||||||
|
|
||||||
app = FastAPI()
|
app = FastAPI()
|
||||||
|
|
||||||
|
_healthy = True # DODANO
|
||||||
|
|
||||||
|
|
||||||
@app.get("/")
|
@app.get("/")
|
||||||
def root():
|
def root():
|
||||||
return {"message": "Pozdrav svijete"}
|
return {"message": "Pozdrav svijete"}
|
||||||
|
|
||||||
|
|
||||||
@app.get("/health")
|
@app.get("/health")
|
||||||
def health():
|
def health():
|
||||||
return {"status": "ok"}
|
if not _healthy: # DODANO
|
||||||
|
return {"status": "unhealthy"}
|
||||||
|
return {"status": "ok"}
|
||||||
|
|
||||||
|
|
||||||
|
@app.post("/break") # DODANO
|
||||||
|
def break_health():
|
||||||
|
global _healthy
|
||||||
|
_healthy = False
|
||||||
|
return {"message": "Servis je sada nezdrav — ocekuj restart"}
|
||||||
Reference in New Issue
Block a user