-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
33 lines (24 loc) · 784 Bytes
/
Copy pathapp.py
File metadata and controls
33 lines (24 loc) · 784 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import os
import socket
from flask import Flask, jsonify, render_template
app = Flask(__name__)
@app.route("/")
def index():
return render_template(
"index.html",
app_name=os.environ.get("APP_NAME", "Custom Image Web App"),
image_name=os.environ.get("IMAGE_NAME", "vacation-planner-webapp:v1"),
hostname=socket.gethostname(),
)
@app.route("/api/status")
def status():
return jsonify(
{
"status": "ok",
"app": os.environ.get("APP_NAME", "Custom Image Web App"),
"image": os.environ.get("IMAGE_NAME", "vacation-planner-webapp:v1"),
"hostname": socket.gethostname(),
}
)
if __name__ == "__main__":
app.run(host="0.0.0.0", port=int(os.environ.get("PORT", "80")))